~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/samples/wxPIA_book/Chapter-09/modal_dialog.py

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import wx
 
2
 
 
3
class SubclassDialog(wx.Dialog):
 
4
    def __init__(self):
 
5
        wx.Dialog.__init__(self, None, -1, 'Dialog Subclass', 
 
6
                size=(300, 100))
 
7
        okButton = wx.Button(self, wx.ID_OK, "OK", pos=(15, 15))
 
8
        okButton.SetDefault()
 
9
        cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel", 
 
10
                pos=(115, 15))
 
11
        
 
12
if __name__ == '__main__':
 
13
    app = wx.PySimpleApp()
 
14
    app.MainLoop() 
 
15
    dialog = SubclassDialog()
 
16
    result = dialog.ShowModal()
 
17
    if result == wx.ID_OK:
 
18
        print "OK"
 
19
    else:
 
20
        print "Cancel"
 
21
    dialog.Destroy()