[PyKDE] AttributeError in PyQt on WinXP

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jun 1 08:40:02 BST 2006


On Thursday 01 June 2006 12:38 am, Rightful King wrote:
> Hey all,
>
> Here is the code:
>
> import sys
> from Qt import *
>
> a = QApplication([])
>
> # Our function to call when the button is clicked
> def sayHello():
>     print "Hello, World!"
>
> # Instantiate the button
> hellobutton = QPushButton("Say 'Hello world!'",None)
>
> # And connect the action "sayHello" to the event "button has been clicked"
> a.connect(hellobutton, SIGNAL("clicked()"), sayHello)
>
> # The rest is known already...
> a.set_main_widget(hellobutton)
> hellobutton.show()
> a.exec_loop()
>
>
> I get the following message: AttributeError: set_main_widget

setMainWidget() is PyQt3. There is no equivalent in PyQt4.

> When I comment out that line, I get the same message about exec_loop.
> What's up?

exec_loop() is PyQt3. The PyQt4 equivalent is exec_().

Phil




More information about the PyQt mailing list