Really strange behavior

Sion Arrowsmith siona at chiark.greenend.org.uk
Mon Nov 6 16:53:19 CET 2006


IloChab  <IloChab at yahoo.it> wrote:
[this works]
>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()
[this doesn't]
>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()

I don't know if this is the problem or not (knowing neither Qt nor
Twisted), but creWin() creates a window (or two) then throws it
(them?) away on returning to main() (I assume you've chopped
off the bit where main() is actually called). So it's not too
surprising your window doesn't show: by the time you get to
running anything, you don't have a window object to show. (Unless
a Qt application object is a discoverable global and windows
inject a reference to themselves into it.)

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list