[Twisted-Python] TextEntry

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Nov 18 00:00:45 EST 2010

On 17 Nov, 09:56 pm, rsgames at inbox.com wrote:
>I have been using the following code to show the user a 
>TextEntryDialog, that would allow users to enter data in, and press 
>return. Since I've started using Twisted, this doesn't work on Mac OS 
>X. The dialog pops up okay, but you can't actually enter any data into 
>the box. The cursor does not appear. When I click inside the box to try 
>to make it appear, it quickly disappears again.
>def handle_input(data):
>prompt=data.replace("+INPUT ","")
>new=wx.TextEntryDialog(global_vars.frame, "", prompt)
>if new.ShowModal() == wx.ID_OK:
>  socks.sockObj.sendData(new.GetValue())
>  socks.sockObj.sendData("+~!?CANCEL?!~")
>  new.Destroy()

You probably want to avoid modal dialogs (in any toolkit) when 
integrating with Twisted.  The require a reentrant mainloop to 
implement, and no Twisted reactor (ie, mainloop) is reentrant.

Whether or not the fact that this is a modal dialog is actually causing 
this particular problem, I don't know.


More information about the Twisted-Python mailing list