]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/wxPIA_book/Chapter-09/modal_dialog.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-09 / modal_dialog.py
diff --git a/wxPython/samples/wxPIA_book/Chapter-09/modal_dialog.py b/wxPython/samples/wxPIA_book/Chapter-09/modal_dialog.py
new file mode 100644 (file)
index 0000000..f4dcd71
--- /dev/null
@@ -0,0 +1,21 @@
+import wx
+
+class SubclassDialog(wx.Dialog):
+    def __init__(self):
+        wx.Dialog.__init__(self, None, -1, 'Dialog Subclass', 
+                size=(300, 100))
+        okButton = wx.Button(self, wx.ID_OK, "OK", pos=(15, 15))
+        okButton.SetDefault()
+        cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel", 
+                pos=(115, 15))
+        
+if __name__ == '__main__':
+    app = wx.PySimpleApp()
+    app.MainLoop() 
+    dialog = SubclassDialog()
+    result = dialog.ShowModal()
+    if result == wx.ID_OK:
+        print "OK"
+    else:
+        print "Cancel"
+    dialog.Destroy()