]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxPopupWindow.py
implemented wxApp::Get/SetDisplayMode
[wxWidgets.git] / wxPython / demo / wxPopupWindow.py
1 from wxPython.wx import *
2
3 #---------------------------------------------------------------------------
4
5 class TestPopup(wxPopupWindow):
6 def __init__(self, parent, style):
7 wxPopupWindow.__init__(self, parent, style)
8
9 EVT_LEFT_DOWN(self, self.OnMouseLeftDown)
10 EVT_MOTION(self, self.OnMouseMotion)
11 EVT_LEFT_UP(self, self.OnMouseLeftUp)
12
13 def OnMouseLeftDown(self, evt):
14 self.ldPos = evt.GetPosition()
15 self.CaptureMouse()
16
17 def OnMouseMotion(self, evt):
18 if evt.Dragging():
19 wPos = self.GetPosition()
20 dPos = evt.GetPosition()
21 self.Move((wPos.x + (dPos.x - self.ldPos.x),
22 wPos.y + (dPos.y - self.ldPos.y)))
23 print self.GetPosition()
24
25 def OnMouseLeftUp(self, evt):
26 self.ReleaseMouse()
27 pass
28
29
30
31 class TestPanel(wxPanel):
32 def __init__(self, parent, log):
33 wxPanel.__init__(self, parent, -1)
34 self.log = log
35
36 b = wxButton(self, -1, "Show popup window", (25, 50))
37 EVT_BUTTON(self, b.GetId(), self.OnShowPopup)
38
39
40 def OnShowPopup(self, evt):
41 win = TestPopup(self, wxSIMPLE_BORDER)
42 #win.SetPosition((200, 200))
43 #win.SetSize((150, 150))
44 win.Position((200, 200), (150, 150))
45 win.SetBackgroundColour("CADET BLUE")
46 win.Show(true)
47
48
49
50 #---------------------------------------------------------------------------
51
52 def runTest(frame, nb, log):
53 win = TestPanel(nb, log)
54 return win
55
56 #---------------------------------------------------------------------------
57
58
59
60
61 overview = """\
62 """