<br><br><div class="gmail_quote">On Fri, Feb 26, 2010 at 11:40 AM, Marco Martin <span dir="ltr"><<a href="mailto:notmart@gmail.com">notmart@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Thu, Feb 25, 2010 at 10:29 PM, Antony Loebs<br>
<<a href="mailto:barefootedjournalist@gmail.com">barefootedjournalist@gmail.com</a>> wrote:<br>
> I have been trying to figure out how to display a rectangular image in the<br>
> panel to use as a button. The image itself is 30x120, but I can't get it to<br>
> display to my satisfaction. If I use IconWidget, the image is squashed into<br>
> a square. If I use PushButton, the image is likewise squashed by the<br>
> button's borders. I tried changing the stylesheet for the button, setting<br>
> margin and padding to 0, but with no success. Below is the sample code (the<br>
> PushButton code is commented out).<br>
<br>
</div>to just display an image you probably want to use Label (yes, it can<br>
display images and a click signaliirc)<br>
<br></blockquote><div> Two problems: one, I don't see how to make a click on a label register, and two, while it looks fine on the desktop, if it is started in the panel it is squashed horizontally (so the image looks like a vertical line about four or five pixels wide). Additionally, when I rescale the panel, the image scales vertically, but not horizontally.<br>
<br>Here is the changes to the code:<br>---<br>import subprocess<br><br></div></div>self.button = Plasma.Label(self.applet)<br>self.button.setImage(self.package().path() + "contents/images/image.png")<br>self.button.setScaledContents(True)<br>
self.connect(self.button, SIGNAL("linkActivated()"), self.notify)<br><br>def notify(self):<br> subprocess.Popen(['qdbus', 'org.kde.lancelot', '/Lancelot', 'show', '0', '0'])<br>
---<br>