]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxPopupWindow.py
1 from wxPython
.wx
import *
3 #---------------------------------------------------------------------------
5 class TestPopup(wxPopupWindow
):
6 def __init__(self
, parent
, style
):
7 wxPopupWindow
.__init
__(self
, parent
, style
)
9 EVT_LEFT_DOWN(self
, self
.OnMouseLeftDown
)
10 EVT_MOTION(self
, self
.OnMouseMotion
)
11 EVT_LEFT_UP(self
, self
.OnMouseLeftUp
)
13 def OnMouseLeftDown(self
, evt
):
14 self
.ldPos
= evt
.GetPosition()
17 def OnMouseMotion(self
, evt
):
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()
25 def OnMouseLeftUp(self
, evt
):
31 class TestPanel(wxPanel
):
32 def __init__(self
, parent
, log
):
33 wxPanel
.__init
__(self
, parent
, -1)
36 b
= wxButton(self
, -1, "Show popup window", (25, 50))
37 EVT_BUTTON(self
, b
.GetId(), self
.OnShowPopup
)
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")
50 #---------------------------------------------------------------------------
52 def runTest(frame
, nb
, log
):
53 win
= TestPanel(nb
, log
)
56 #---------------------------------------------------------------------------