Quickly and Python Twisted

Posted by Aaron on Ask Ubuntu See other posts from Ask Ubuntu or by Aaron
Published on 2012-06-25T13:50:20Z Indexed on 2012/06/27 15:26 UTC
Read the original article Hit count: 266

Filed under:
|
|

I am creating a Quickly application that makes use of Python Twisted. When the user launches a window, I want to start the Twisted server I wrote. However, when I do this, it freezes the GUI, because the reactor.run method is constantly running after it is started. I need a way to start the Twisted reactor in its own thread, so that the GUI will continue to operate while the reactor is running. I have read about using Twisted with pyGTK in the Twisted documentation, but I am not sure how I would accomplish this with a Quickly application. What is the best way to start my Twisted server when a window opens without freezing the GUI?

Update:

My if __name__ == '__main__' statement at the end of my dialog file is:

print 'Preparing GLib'
GLib.idle_add(before_running)
print 'Staring Reactor'
from twisted.internet import reactor
reactor.run()`

I have imported and installed twisted.gtk3reactor earlier on in the file. The before_running method contains dialog = ClientDialog() and dialog.show, as well as the rest of the code I want to run when the dialog opens.

© Ask Ubuntu or respective owner

Related posts about networking

Related posts about python