[PyKDE] Problem: drawPushButton

Grzegorz Zegartowski greg at itam.zabrze.pl
Wed Jul 11 08:42:16 BST 2001


I've maid some mistakes in last letter.
Now everything should be ok (I hope)

> Hello
> I wrote a simple program, and it doesn't work:
>
> #############################################################
> File "test.py", line 12, in drawButton
>    self.style().drawPushButton(self, painter) #!error
> AttributeError: drawPushButton
> #############################################################
>
> Any ideas?
>
>
>
#################################################################################

> ##
> import sys
> from qt import *
>
> class MyPushButton(QPushButton):
>    """"""
>    def __init__(self, parent=None, name=None):
>        QPushButton.__init__(self, parent, name)
>      def drawButton(self, painter):
>        self.style().drawPushButton(self, painter) #!error
>        self.drawButtonLabel(painter)
>
>
> def main ():
>    """main"""
>    app = QApplication(sys.argv)
>    mybtn = MyPushButton()
>    mybtn.setText("test")
>    app.setMainWidget(mybtn)
>    mybtn.show()
>    app.exec_loop()
>
> if __name__ == '__main__':
>    main()
>
#########################################################################################

>
>
> Greg
>





More information about the PyQt mailing list