]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/MessageDialog.py
Cancel the timer and show the main frame immediately if the
[wxWidgets.git] / wxPython / demo / MessageDialog.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 MessageDialog", (50,50))
12 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
13
14
15 def OnButton(self, evt):
16 dlg = wx.MessageDialog(self, 'Hello from Python and wxPython!',
17 'A Message Box',
18 wx.OK | wx.ICON_INFORMATION
19 #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
20 )
21 dlg.ShowModal()
22 dlg.Destroy()
23
24
25 #---------------------------------------------------------------------------
26
27
28 def runTest(frame, nb, log):
29 win = TestPanel(nb, log)
30 return win
31
32
33 #---------------------------------------------------------------------------
34
35
36
37 overview = """\
38 <html><body>
39 <h2>wx.MessageDialog</h2>
40
41 This class represents a dialog that shows a single or multi-line
42 message, with a choice of OK, Yes, No and Cancel buttons.
43 Additionally, various style flags can determine whether an icon is
44 displayed, and, if so, what kind. The return value of ShowModal
45 indicates which button was pressed.
46
47 """
48
49
50 if __name__ == '__main__':
51 import sys,os
52 import run
53 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])