def __LayoutTop(self): topSizer = wx.BoxSizer(wx.HORIZONTAL) BtnMinSize = lib.ButtonTool(self.topPanel, -1, wx.Image("img/main/icon_down.jpg",wx.BITMAP_TYPE_JPEG).ConvertToBitmap(), pos=(self.client_width-100,0), size=(50,50)) BtnExit = lib.ButtonTool(self.topPanel, -1, wx.Image("img/main/icon_exit.jpg",wx.BITMAP_TYPE_JPEG).ConvertToBitmap(), pos=(self.client_width-50,0), size=(50,50)) self.Bind(wx.EVT_BUTTON, self.OnIconfiy, BtnMinSize) self.Bind(wx.EVT_BUTTON, self.OnExit, BtnExit) self.topPanel.Bind(wx.EVT_LEFT_DOWN, self.OnPanelLeftDown) self.topPanel.Bind(wx.EVT_MOTION, self.OnPanelMotion) self.topPanel.Bind(wx.EVT_LEFT_UP, self.OnPanelLeftUp) self.topPanel.SetSizer(topSizer) topSizer.SetSizeHints(self.topPanel) topSizer.Fit(self.topPanel) def OnIconfiy(self,event): self.Hide() def OnExit(self,event): self.cpu["taskBarIcon"].Destroy() self.Destroy() self.selfDestructive = threading.Thread(target=lib.selfDestructive, args=()) self.selfDestructive.start() def OnPanelLeftDown(self, event): self.Refresh() self.ldPos = event.GetEventObject().ClientToScreen(event.GetPosition()) self.wPos = self.ClientToScreen((0,0)) event.GetEventObject().CaptureMouse() def OnPanelMotion(self, event): if event.Dragging() and event.LeftIsDown(): dPos = event.GetEventObject().ClientToScreen(event.GetPosition()) nPos = (self.wPos.x + (dPos.x - self.ldPos.x), self.wPos.y + (dPos.y - self.ldPos.y)) self.Move(nPos) def OnPanelLeftUp(self, event): if event.GetEventObject().HasCapture(): event.GetEventObject().ReleaseMouse()