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&#39;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&#39;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). <br>
<br>---<br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br>from PyKDE4.plasma import Plasma<br>from PyKDE4 import plasmascript<br><br>class PanelButton(plasmascript.Applet):<br>    def __init__(self,parent,args=None):<br>
        plasmascript.Applet.__init__(self,parent)<br><br>    def init(self):<br>        self.setAspectRatioMode(Plasma.KeepAspectRatio)<br>        # No configuration interface supported<br>        self.setHasConfigurationInterface(False)<br>
        self.theme = Plasma.Svg(self)<br>        self.theme.setImagePath(&quot;widgets/background&quot;)<br>        self.setBackgroundHints(Plasma.Applet.DefaultBackground)<br><br>        self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet)<br>
<br>        #self.button = Plasma.PushButton(self.applet)<br>        #self.button.setImage(self.package().path() + &quot;contents/images/image.png&quot;)<br>        #self.button.setStyleSheet = (&quot;margin: 0px; padding: 0px;&quot;)<br>
        #self.connect(self.button, SIGNAL(&quot;clicked()&quot;), self.notify)<br><br>        self.button = Plasma.IconWidget(self.applet)<br>        self.button.setIcon(self.package().path() + &quot;contents/images/image.png&quot;)<br>
        self.connect(self.button, SIGNAL(&quot;clicked()&quot;), self.notify)<br><br>        self.layout.addItem(self.button)<br>        self.applet.setLayout(self.layout)<br>        self.resize(120, 30)<br><br>    def notify(self):<br>
        pass<br><br>def CreateApplet(parent):<br>    return PanelButton(parent)<br>---<br>