]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/TextEntryDialog.py
4 #---------------------------------------------------------------------------
6 class TestPanel(wx
.Panel
):
7 def __init__(self
, parent
, log
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 b
= wx
.Button(self
, -1, "Create and Show a TextEntryDialog", (50,50))
12 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
15 def OnButton(self
, evt
):
16 dlg
= wx
.TextEntryDialog(
17 self
, 'What is your favorite programming language?',
20 dlg
.SetValue("Python is the best!")
22 if dlg
.ShowModal() == wx
.ID_OK
:
23 self
.log
.WriteText('You entered: %s\n' % dlg
.GetValue())
30 #---------------------------------------------------------------------------
33 def runTest(frame
, nb
, log
):
34 win
= TestPanel(nb
, log
)
37 #---------------------------------------------------------------------------
42 This class represents a dialog that requests a one-line text string from the user.
43 It is implemented as a generic wxWindows dialog. Along with the usual wx.Dialog
44 style flags, all of the wx.TextCtrl TE_* style flags are accepted, so, for example,
45 wx.TE_PASSWORD could be used to create a password dialog.
47 As with other dialogs of this type, the user input must be retrieved prior to
48 destroying the dialog.
53 if __name__
== '__main__':
56 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])