Python wx.EVT_MIDDLE_DOWN Examples
The following are 9
code examples of wx.EVT_MIDDLE_DOWN().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: mainframe.py From youtube-dl-gui with The Unlicense | 6 votes |
def _create_textctrl(self, style=None, event_handler=None): if style is None: textctrl = wx.TextCtrl(self._panel) else: textctrl = wx.TextCtrl(self._panel, style=style) if event_handler is not None: textctrl.Bind(wx.EVT_TEXT_PASTE, event_handler) textctrl.Bind(wx.EVT_MIDDLE_DOWN, event_handler) if os.name == 'nt': # Enable CTRL+A on Windows def win_ctrla_eventhandler(event): if event.GetKeyCode() == wx.WXK_CONTROL_A: event.GetEventObject().SelectAll() event.Skip() textctrl.Bind(wx.EVT_CHAR, win_ctrla_eventhandler) return textctrl
Example #2
Source File: edit_base.py From wxGlade with MIT License | 6 votes |
def create_widget(self): if self.overlapped and self.parent._IS_GRIDBAG: return style = wx.FULL_REPAINT_ON_RESIZE if self.parent.CHILDREN in (-1, 1): # e.g. Panel in a Frame size = self.parent.widget.GetClientSize() else: size = (20, 20) self.widget = wx.Window(self.parent_window.widget, -1, size=size, style=style) self.widget.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) #self.widget.SetAutoLayout(True) self.widget.Bind(wx.EVT_PAINT, self.on_paint) self.widget.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase_background) self.widget.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu) self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_drop_widget) self.widget.Bind(wx.EVT_MIDDLE_DOWN, misc.exec_after(self.on_select_and_paste)) self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter) self.widget.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave) #self.widget.Bind(wx.EVT_CHAR_HOOK, misc.on_key_down_event) # catch cursor keys XXX still required?
Example #3
Source File: edit_base.py From wxGlade with MIT License | 6 votes |
def destroy_widget(self, level): if self.widget is None: return if misc.currently_under_mouse is self.widget: misc.currently_under_mouse = None self.widget.Hide() if wx.VERSION_STRING!="2.8.12.0": # unbind events to prevent new created (and queued) events self.widget.Bind(wx.EVT_PAINT, None) self.widget.Bind(wx.EVT_RIGHT_DOWN, None) self.widget.Bind(wx.EVT_LEFT_DOWN, None) self.widget.Bind(wx.EVT_MIDDLE_DOWN, None) self.widget.Bind(wx.EVT_ENTER_WINDOW, None) self.widget.Bind(wx.EVT_LEAVE_WINDOW, None) self.widget.Bind(wx.EVT_KEY_DOWN, None) compat.DestroyLater(self.widget) self.widget = None if misc.focused_widget is self: misc.set_focused_widget(None)
Example #4
Source File: MeshCanvas.py From laplacian-meshes with GNU General Public License v3.0 | 5 votes |
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)
Example #5
Source File: backend_wx.py From Mastering-Elasticsearch-7.0 with MIT License | 4 votes |
def __init__(self, parent, id, figure): """ Initialise a FigureWx instance. - Initialise the FigureCanvasBase and wxPanel parents. - Set event handlers for: EVT_SIZE (Resize event) EVT_PAINT (Paint event) """ FigureCanvasBase.__init__(self, figure) # Set preferred window size hint - helps the sizer (if one is # connected) l, b, w, h = figure.bbox.bounds w = math.ceil(w) h = math.ceil(h) wx.Panel.__init__(self, parent, id, size=wx.Size(w, h)) # Create the drawing bitmap self.bitmap = wx.Bitmap(w, h) DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self) # TODO: Add support for 'point' inspection and plot navigation. self._isDrawn = False self.Bind(wx.EVT_SIZE, self._onSize) self.Bind(wx.EVT_PAINT, self._onPaint) self.Bind(wx.EVT_KEY_DOWN, self._onKeyDown) self.Bind(wx.EVT_KEY_UP, self._onKeyUp) self.Bind(wx.EVT_RIGHT_DOWN, self._onRightButtonDown) self.Bind(wx.EVT_RIGHT_DCLICK, self._onRightButtonDClick) self.Bind(wx.EVT_RIGHT_UP, self._onRightButtonUp) self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel) self.Bind(wx.EVT_LEFT_DOWN, self._onLeftButtonDown) self.Bind(wx.EVT_LEFT_DCLICK, self._onLeftButtonDClick) self.Bind(wx.EVT_LEFT_UP, self._onLeftButtonUp) self.Bind(wx.EVT_MOTION, self._onMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self._onLeave) self.Bind(wx.EVT_ENTER_WINDOW, self._onEnter) # Add middle button events self.Bind(wx.EVT_MIDDLE_DOWN, self._onMiddleButtonDown) self.Bind(wx.EVT_MIDDLE_DCLICK, self._onMiddleButtonDClick) self.Bind(wx.EVT_MIDDLE_UP, self._onMiddleButtonUp) self.Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._onCaptureLost) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self._onCaptureLost) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker. self.SetBackgroundColour(wx.WHITE)
Example #6
Source File: backend_wx.py From GraphicDesignPatternByPython with MIT License | 4 votes |
def __init__(self, parent, id, figure): """ Initialise a FigureWx instance. - Initialise the FigureCanvasBase and wxPanel parents. - Set event handlers for: EVT_SIZE (Resize event) EVT_PAINT (Paint event) """ FigureCanvasBase.__init__(self, figure) # Set preferred window size hint - helps the sizer (if one is # connected) l, b, w, h = figure.bbox.bounds w = math.ceil(w) h = math.ceil(h) wx.Panel.__init__(self, parent, id, size=wx.Size(w, h)) # Create the drawing bitmap self.bitmap = wx.Bitmap(w, h) DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self) # TODO: Add support for 'point' inspection and plot navigation. self._isDrawn = False self.Bind(wx.EVT_SIZE, self._onSize) self.Bind(wx.EVT_PAINT, self._onPaint) self.Bind(wx.EVT_KEY_DOWN, self._onKeyDown) self.Bind(wx.EVT_KEY_UP, self._onKeyUp) self.Bind(wx.EVT_RIGHT_DOWN, self._onRightButtonDown) self.Bind(wx.EVT_RIGHT_DCLICK, self._onRightButtonDClick) self.Bind(wx.EVT_RIGHT_UP, self._onRightButtonUp) self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel) self.Bind(wx.EVT_LEFT_DOWN, self._onLeftButtonDown) self.Bind(wx.EVT_LEFT_DCLICK, self._onLeftButtonDClick) self.Bind(wx.EVT_LEFT_UP, self._onLeftButtonUp) self.Bind(wx.EVT_MOTION, self._onMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self._onLeave) self.Bind(wx.EVT_ENTER_WINDOW, self._onEnter) # Add middle button events self.Bind(wx.EVT_MIDDLE_DOWN, self._onMiddleButtonDown) self.Bind(wx.EVT_MIDDLE_DCLICK, self._onMiddleButtonDClick) self.Bind(wx.EVT_MIDDLE_UP, self._onMiddleButtonUp) self.Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._onCaptureLost) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self._onCaptureLost) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker. self.SetBackgroundColour(wx.WHITE)
Example #7
Source File: backend_wx.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 4 votes |
def __init__(self, parent, id, figure): """ Initialise a FigureWx instance. - Initialise the FigureCanvasBase and wxPanel parents. - Set event handlers for: EVT_SIZE (Resize event) EVT_PAINT (Paint event) """ FigureCanvasBase.__init__(self, figure) # Set preferred window size hint - helps the sizer (if one is # connected) l, b, w, h = figure.bbox.bounds w = math.ceil(w) h = math.ceil(h) wx.Panel.__init__(self, parent, id, size=wx.Size(w, h)) # Create the drawing bitmap self.bitmap = wx.Bitmap(w, h) DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self) # TODO: Add support for 'point' inspection and plot navigation. self._isDrawn = False self.Bind(wx.EVT_SIZE, self._onSize) self.Bind(wx.EVT_PAINT, self._onPaint) self.Bind(wx.EVT_KEY_DOWN, self._onKeyDown) self.Bind(wx.EVT_KEY_UP, self._onKeyUp) self.Bind(wx.EVT_RIGHT_DOWN, self._onRightButtonDown) self.Bind(wx.EVT_RIGHT_DCLICK, self._onRightButtonDClick) self.Bind(wx.EVT_RIGHT_UP, self._onRightButtonUp) self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel) self.Bind(wx.EVT_LEFT_DOWN, self._onLeftButtonDown) self.Bind(wx.EVT_LEFT_DCLICK, self._onLeftButtonDClick) self.Bind(wx.EVT_LEFT_UP, self._onLeftButtonUp) self.Bind(wx.EVT_MOTION, self._onMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self._onLeave) self.Bind(wx.EVT_ENTER_WINDOW, self._onEnter) # Add middle button events self.Bind(wx.EVT_MIDDLE_DOWN, self._onMiddleButtonDown) self.Bind(wx.EVT_MIDDLE_DCLICK, self._onMiddleButtonDClick) self.Bind(wx.EVT_MIDDLE_UP, self._onMiddleButtonUp) self.Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._onCaptureLost) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self._onCaptureLost) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker. self.SetBackgroundColour(wx.WHITE)
Example #8
Source File: backend_wx.py From coffeegrindsize with MIT License | 4 votes |
def __init__(self, parent, id, figure): """ Initialise a FigureWx instance. - Initialise the FigureCanvasBase and wxPanel parents. - Set event handlers for: EVT_SIZE (Resize event) EVT_PAINT (Paint event) """ FigureCanvasBase.__init__(self, figure) # Set preferred window size hint - helps the sizer (if one is # connected) l, b, w, h = figure.bbox.bounds w = math.ceil(w) h = math.ceil(h) wx.Panel.__init__(self, parent, id, size=wx.Size(w, h)) # Create the drawing bitmap self.bitmap = wx.Bitmap(w, h) DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self) # TODO: Add support for 'point' inspection and plot navigation. self._isDrawn = False self.Bind(wx.EVT_SIZE, self._onSize) self.Bind(wx.EVT_PAINT, self._onPaint) self.Bind(wx.EVT_KEY_DOWN, self._onKeyDown) self.Bind(wx.EVT_KEY_UP, self._onKeyUp) self.Bind(wx.EVT_RIGHT_DOWN, self._onRightButtonDown) self.Bind(wx.EVT_RIGHT_DCLICK, self._onRightButtonDClick) self.Bind(wx.EVT_RIGHT_UP, self._onRightButtonUp) self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel) self.Bind(wx.EVT_LEFT_DOWN, self._onLeftButtonDown) self.Bind(wx.EVT_LEFT_DCLICK, self._onLeftButtonDClick) self.Bind(wx.EVT_LEFT_UP, self._onLeftButtonUp) self.Bind(wx.EVT_MOTION, self._onMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self._onLeave) self.Bind(wx.EVT_ENTER_WINDOW, self._onEnter) # Add middle button events self.Bind(wx.EVT_MIDDLE_DOWN, self._onMiddleButtonDown) self.Bind(wx.EVT_MIDDLE_DCLICK, self._onMiddleButtonDClick) self.Bind(wx.EVT_MIDDLE_UP, self._onMiddleButtonUp) self.Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._onCaptureLost) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self._onCaptureLost) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker. self.SetBackgroundColour(wx.WHITE)
Example #9
Source File: backend_wx.py From CogAlg with MIT License | 4 votes |
def __init__(self, parent, id, figure): """ Initialise a FigureWx instance. - Initialise the FigureCanvasBase and wxPanel parents. - Set event handlers for: EVT_SIZE (Resize event) EVT_PAINT (Paint event) """ FigureCanvasBase.__init__(self, figure) # Set preferred window size hint - helps the sizer (if one is # connected) l, b, w, h = figure.bbox.bounds w = math.ceil(w) h = math.ceil(h) wx.Panel.__init__(self, parent, id, size=wx.Size(w, h)) # Create the drawing bitmap self.bitmap = wx.Bitmap(w, h) DEBUG_MSG("__init__() - bitmap w:%d h:%d" % (w, h), 2, self) # TODO: Add support for 'point' inspection and plot navigation. self._isDrawn = False self.Bind(wx.EVT_SIZE, self._onSize) self.Bind(wx.EVT_PAINT, self._onPaint) self.Bind(wx.EVT_KEY_DOWN, self._onKeyDown) self.Bind(wx.EVT_KEY_UP, self._onKeyUp) self.Bind(wx.EVT_RIGHT_DOWN, self._onRightButtonDown) self.Bind(wx.EVT_RIGHT_DCLICK, self._onRightButtonDClick) self.Bind(wx.EVT_RIGHT_UP, self._onRightButtonUp) self.Bind(wx.EVT_MOUSEWHEEL, self._onMouseWheel) self.Bind(wx.EVT_LEFT_DOWN, self._onLeftButtonDown) self.Bind(wx.EVT_LEFT_DCLICK, self._onLeftButtonDClick) self.Bind(wx.EVT_LEFT_UP, self._onLeftButtonUp) self.Bind(wx.EVT_MOTION, self._onMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self._onLeave) self.Bind(wx.EVT_ENTER_WINDOW, self._onEnter) # Add middle button events self.Bind(wx.EVT_MIDDLE_DOWN, self._onMiddleButtonDown) self.Bind(wx.EVT_MIDDLE_DCLICK, self._onMiddleButtonDClick) self.Bind(wx.EVT_MIDDLE_UP, self._onMiddleButtonUp) self.Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._onCaptureLost) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self._onCaptureLost) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) # Reduce flicker. self.SetBackgroundColour(wx.WHITE)