]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/TextEntryDialog.py
Updated OpenVMS compile support
[wxWidgets.git] / wxPython / demo / TextEntryDialog.py
1
2 import wx
3
4 #---------------------------------------------------------------------------
5
6 class 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
33 def runTest(frame, nb, log):
34 win = TestPanel(nb, log)
35 return win
36
37 #---------------------------------------------------------------------------
38
39
40
41 overview = """\
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.
46
47 As with other dialogs of this type, the user input must be retrieved prior to
48 destroying the dialog.
49
50 """
51
52
53 if __name__ == '__main__':
54 import sys,os
55 import run
56 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])