User defined dialog box

Skip to first unread message


Dec 12, 2007, 7:45:55 AM12/12/07
to pyxides
The stock dialog boxes are very limited as they only allow one field.
Here is an example of the method I use to generate simple dialogs. It
is documented so that users can do the same for their tools and

from lib import gui

dlg = gui.Dialog("Run " + cmd)
args = dlg.TextEntry("Args:")
sudo = dlg.Option("Run as root")
if dlg.Show():
cmd += " " + text.value
if sudo.value:
opt = "sudo"

The PySimpleApp and all the wx stuff is hidden. The data objects are
retained after the dialog is closed so that their values can be
obtained. The Show() function returns True for OK and False for
Cancel. I think that something like this might be useful as a
general module.
Reply all
Reply to author
0 new messages