]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/TextEntryDialog.py
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / wxPython / demo / TextEntryDialog.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
4#---------------------------------------------------------------------------
5
34a544a6
RD
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())
8fa876ca 24
34a544a6 25 dlg.Destroy()
8fa876ca 26
cf694132
RD
27
28
34a544a6
RD
29
30#---------------------------------------------------------------------------
31
32
33def runTest(frame, nb, log):
34 win = TestPanel(nb, log)
35 return win
36
cf694132
RD
37#---------------------------------------------------------------------------
38
39
40
1fded56b 41overview = """\
8fa876ca 42This class represents a dialog that requests a one-line text string from the user.
95bfd958
RD
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,
8fa876ca 45wx.TE_PASSWORD could be used to create a password dialog.
cf694132 46
8fa876ca
RD
47As with other dialogs of this type, the user input must be retrieved prior to
48destroying the dialog.
cf694132 49
8fa876ca 50"""
cf694132
RD
51
52
1fded56b
RD
53if __name__ == '__main__':
54 import sys,os
55 import run
8eca4fef 56 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])