1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Jolie frame", pos = wx.DefaultPosition, size = (600, 300), style = wx.BORDER_NONE)
self.timer = wx.Timer(self, -1)
self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.onLeftUp)
self.Bind(wx.EVT_TIMER, self.onTick, self.timer)
print self.GetWindowBorderSize()
self.posClick = None
def onLeftDown(self, e):
if wx.GetKeyState(wx.WXK_ALT):
self.posClick = e.GetPosition()
self.timer.Start(milliseconds=50, oneShot=False)
def onLeftUp(self, e):
if self.timer.IsRunning():
self.timer.Stop()
def onTick(self, e):
pos = wx.GetMousePosition()
newPos = pos-self.posClick
self.Move(newPos)
app = wx.PySimpleApp()
frame = MyFrame()
frame.Show()
app.MainLoop() |
Partager