]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/TextEntryDialog.py
wxCheckListBox doesn't require wxUSE_OWNER_DRAWN when using WXUNIVERSAL
[wxWidgets.git] / wxPython / demo / TextEntryDialog.py
... / ...
CommitLineData
1
2import wx
3
4#---------------------------------------------------------------------------
5
6class TestPanel(wx.Panel):
7 def __init__(self, parent, log):
8 self.log = log
9 wx.Panel.__init__(self, parent, -1)
10
11 b = wx.Button(self, -1, "Create and Show a TextEntryDialog", (50,50))
12 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
13
14
15 def OnButton(self, evt):
16 dlg = wx.TextEntryDialog(
17 self, 'What is your favorite programming language?',
18 'Eh??', 'Python')
19
20 dlg.SetValue("Python is the best!")
21
22 if dlg.ShowModal() == wx.ID_OK:
23 self.log.WriteText('You entered: %s\n' % dlg.GetValue())
24
25 dlg.Destroy()
26
27
28
29
30#---------------------------------------------------------------------------
31
32
33def runTest(frame, nb, log):
34 win = TestPanel(nb, log)
35 return win
36
37#---------------------------------------------------------------------------
38
39
40
41overview = """\
42This class represents a dialog that requests a one-line text string from the user.
43It is implemented as a generic wxWindows dialog. Along with the usual wx.Dialog
44style flags, all of the wx.TextCtrl TE_* style flags are accepted, so, for example,
45wx.TE_PASSWORD could be used to create a password dialog.
46
47As with other dialogs of this type, the user input must be retrieved prior to
48destroying the dialog.
49
50"""
51
52
53if __name__ == '__main__':
54 import sys,os
55 import run
56 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])