我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用wx.EVT_MIDDLE_DOWN。
def BindEvents(self): self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) self.Bind(wx.EVT_RIGHT_DOWN, self.OnButtonDown) self.Bind(wx.EVT_LEFT_DOWN, self.OnButtonDown) self.Bind(wx.EVT_MIDDLE_DOWN, self.OnButtonDown) self.Bind(wx.EVT_RIGHT_UP, self.OnButtonUp) self.Bind(wx.EVT_LEFT_UP, self.OnButtonUp) self.Bind(wx.EVT_MIDDLE_UP, self.OnButtonUp) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) self.Bind(wx.EVT_CHAR, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) if wx.Platform == "__WXGTK__": # wxGTK requires that the window be created before you can # set its shape, so delay the call to SetWindowShape until # this event. self.Bind(wx.EVT_WINDOW_CREATE, self.OnWindowCreate) else: # On wxMSW and wxMac the window has already been created. self.Bind(wx.EVT_SIZE, self.OnSize) if _useCapture and hasattr(wx, 'EVT_MOUSE_CAPTURE_LOST'): self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.OnMouseCaptureLost)
def __init__(self, parent): attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24) glcanvas.GLCanvas.__init__(self, parent, -1, attribList = attribs) self.context = glcanvas.GLContext(self) self.parent = parent #Camera state variables self.size = self.GetClientSize() #self.camera = MouseSphericalCamera(self.size.x, self.size.y) self.camera = MousePolarCamera(self.size.width, self.size.height) #Main state variables self.MousePos = [0, 0] self.bbox = BBox3D() #Face mesh variables and manipulation variables self.mesh = None self.meshCentroid = None self.displayMeshFaces = True self.displayMeshEdges = False self.displayMeshVertices = True self.displayVertexNormals = False self.displayFaceNormals = False self.useLighting = True self.useTexture = False self.GLinitialized = False #GL-related events wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent) wx.EVT_SIZE(self, self.processSizeEvent) wx.EVT_PAINT(self, self.processPaintEvent) #Mouse Events wx.EVT_LEFT_DOWN(self, self.MouseDown) wx.EVT_LEFT_UP(self, self.MouseUp) wx.EVT_RIGHT_DOWN(self, self.MouseDown) wx.EVT_RIGHT_UP(self, self.MouseUp) wx.EVT_MIDDLE_DOWN(self, self.MouseDown) wx.EVT_MIDDLE_UP(self, self.MouseUp) wx.EVT_MOTION(self, self.MouseMotion)
def __init__(self, wx_parent, view_object): super(PlotLabel, self).__init__(wx_parent) self.track_view_object = view_object self._title = None self._visual_objects = [] self.SetBackgroundColour('white') self.SetSizer(wx.BoxSizer(wx.VERTICAL)) self.Bind(wx.EVT_LEFT_DOWN, self._on_press) self.Bind(wx.EVT_MIDDLE_DOWN, self._on_press) self.Bind(wx.EVT_RIGHT_DOWN, self._on_press) self._selected = False