X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25e92d2d64766f076392f710f25c0ac13ef66f4b..47cd661014b0bcf3311d8b6b01e87a13a04a2465:/wxPython/demo/wxPopupWindow.py diff --git a/wxPython/demo/wxPopupWindow.py b/wxPython/demo/wxPopupWindow.py index 055f1c25cc..0ee3df748c 100644 --- a/wxPython/demo/wxPopupWindow.py +++ b/wxPython/demo/wxPopupWindow.py @@ -1,5 +1,12 @@ from wxPython.wx import * +havePopupWindow = 1 +try: + wxPopupWindow +except NameError: + havePopupWindow = 0 + wxPopupWindow = wxPopupTransientWindow = wxWindow + #--------------------------------------------------------------------------- class TestPopup(wxPopupWindow): @@ -48,7 +55,7 @@ class TestPopup(wxPopupWindow): self.ReleaseMouse() def OnRightUp(self, evt): - self.Show(false) + self.Show(False) self.Destroy() @@ -73,7 +80,7 @@ class TestTransientPopup(wxPopupTransientWindow): def ProcessLeftDown(self, evt): self.log.write("ProcessLeftDown\n") - return false + return False def OnDismiss(self): self.log.write("OnDismiss\n") @@ -106,7 +113,7 @@ class TestPanel(wxPanel): sz = btn.GetSize() win.Position(pos, (0, sz.height)) - win.Show(true) + win.Show(True) def OnShowPopupTransient(self, evt): @@ -132,7 +139,7 @@ class TestPanel(wxPanel): sz = btn.GetSize() win.Position(pos, (0, sz.height)) - win.Show(true) + win.Show(True) class TestPopupWithListbox(wxPopupWindow): def __init__(self, parent, style, log): @@ -158,8 +165,14 @@ class TestPopupWithListbox(wxPopupWindow): #--------------------------------------------------------------------------- def runTest(frame, nb, log): - win = TestPanel(nb, log) - return win + if havePopupWindow: + win = TestPanel(nb, log) + return win + else: + dlg = wxMessageDialog(frame, 'wxPopupWindow is not available on this platform.', + 'Sorry', wxOK | wxICON_INFORMATION) + dlg.ShowModal() + dlg.Destroy() #--------------------------------------------------------------------------- @@ -168,3 +181,12 @@ def runTest(frame, nb, log): overview = """\ """ + + + + +if __name__ == '__main__': + import sys,os + import run + run.main(['', os.path.basename(sys.argv[0])]) +