[Twisted-Python] TextEntry

Glyph Lefkowitz glyph at twistedmatrix.com
Fri Nov 19 09:25:40 EST 2010

On Nov 18, 2010, at 6:10 PM, RSGames Support wrote:

> Okay. Well that's not so great - these TextEntryDialogs are quite important to the program. Anyway on Windows and Linux, ShowModal() seems to work really well with wxreactor, and it is only Mac OS X that is the problem.

The key word here is "seems".  You will get weird errors on those platforms eventually, you just haven't yet.

Anyway, it's fine to use dialogs with Twisted.  The issue is APIs like ShowModal(), which expect to be able to block.  Instead you should be using Show(), and make your own API that returns a Deferred from your dialog.

Other toolkits allow you to show a modal dialog without blocking your whole program: for example, with GTK, you can pass the gtk.DIALOG_MODAL flag to gtk.Dialog, and then simply call gtk.Dialog.show_all() instead of gtk.Dialog.run().  wxwindows appears to incorrectly conflate the idea of a modal dialog with a particular type of control flow.

(In my personal opinion, modal dialogs are terrible UI anyway, and should be avoided.  You should be able to prompt the user without interrupting everything else they're doing in the program.)

More information about the Twisted-Python mailing list