Really strange behavior

ArdPy ardsrk at gmail.com
Sat Nov 4 07:57:51 EST 2006


IloChab wrote:
> Sorry I wasn't able to be more specific on my topic but I really do not
> know how to classify my  problem, I mean that I can't understand if it's
> a python
> or a twisted
> or a Qt4
> problem
> I'm trying to run a simple application with Twisted and Qt4.
> To do this I downloaded this:
>     http://twistedmatrix.com/trac/attachment/ticket/1770/qt4reactor.py
> Now,
> if I run this:
> # >>>>>>>>>
> import  qt4reactor
> import sys
> from PyQt4 import  QtGui
> from winIum import Window
>
> def main():
>     app = QtGui.QApplication(sys.argv)
>     qt4reactor.install(app)
>     MainWindow = QtGui.QMainWindow()
>     win = Window(MainWindow)
>     MainWindow.show()
>     from twisted.internet import reactor
>     reactor.run()
> # <<<<<<<<
> my window shows and run correctly.
>
> If I run this:
> # >>>>>>>>>>>>>
> import  qt4reactor
> import sys
> from PyQt4 import  QtGui
> from winIum import Window
>
> def creApp():
>     app = QtGui.QApplication(sys.argv)
>     qt4reactor.install(app)
>     retrun app
> def creWin():
>     MainWindow = QtGui.QMainWindow()
>     win = Window(MainWindow)
>     MainWindow.show()
> def main():
>     app = creApp()
>     creWin()
>     from twisted.internet import reactor
>     reactor.run()
> # <<<<<<<<<<<<<
> my window doesn't show and the script doesn't stop but remains trapped in
> some gui loop.
>
> What's the problem I can't see??
>
> Thank you in advance for any help.
> Licia

Well the only problem according to me could be with the 'from
twisted.internet import reactor' statement.
Try putting this at the beginning of the script. Might be it will work
just fine...




More information about the Python-list mailing list