On Fri, Feb 26, 2010 at 11:40 AM, Marco Martin <notm...@gmail.com> wrote:
> On Thu, Feb 25, 2010 at 10:29 PM, Antony Loebs > <barefootedjournal...@gmail.com> wrote: > > I have been trying to figure out how to display a rectangular image in > the > > panel to use as a button. The image itself is 30x120, but I can't get it > to > > display to my satisfaction. If I use IconWidget, the image is squashed > into > > a square. If I use PushButton, the image is likewise squashed by the > > button's borders. I tried changing the stylesheet for the button, setting > > margin and padding to 0, but with no success. Below is the sample code > (the > > PushButton code is commented out). > > to just display an image you probably want to use Label (yes, it can > display images and a click signaliirc) > > 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. Here is the changes to the code: --- import subprocess self.button = Plasma.Label(self.applet) self.button.setImage(self.package().path() + "contents/images/image.png") self.button.setScaledContents(True) self.connect(self.button, SIGNAL("linkActivated()"), self.notify) def notify(self): subprocess.Popen(['qdbus', 'org.kde.lancelot', '/Lancelot', 'show', '0', '0']) ---
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel