我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用wx.StockCursor()。
def OnMotion(self, event): if wx.Platform == '__WXMSW__': if not event.Dragging(): x, y = event.GetPosition() margin_width = reduce( lambda x, y: x + y, [self.GetMarginWidth(i) for i in xrange(3)], 0) if x <= margin_width: self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) else: self.SetCursor(wx.StockCursor(wx.CURSOR_IBEAM)) else: event.Skip() else: event.Skip()
def SetMode(self, mode): if self.Mode != mode or mode == MODE_SELECTION: if self.Mode == MODE_MOTION: wx.CallAfter(self.Editor.SetCursor, wx.NullCursor) self.Mode = mode self.SavedMode = False else: self.SavedMode = True # Reset selection if self.Mode != MODE_SELECTION and self.SelectedElement: self.SelectedElement.SetSelected(False) self.SelectedElement = None if self.Mode == MODE_MOTION: wx.CallAfter(self.Editor.SetCursor, wx.StockCursor(wx.CURSOR_HAND)) self.SavedMode = True # Return current drawing mode
def OnLeftDown(self, event, dc, scaling): """ Called when left mouse is pressed on Viewer. Starts to edit a new rubberband bounding box @param event: Mouse event @param dc: Device Context of Viewer @param scaling: PLCOpen scaling applied on Viewer """ # Save the point where mouse was pressed in Viewer unit, position may # be modified by scroll and zoom applied on viewer self.StartPoint = GetScaledEventPosition(event, dc, scaling) # Initialize rubberband bounding box self.CurrentBBox = wx.Rect(self.StartPoint.x, self.StartPoint.y, 0, 0) # Change viewer mouse cursor to reflect a rubberband bounding box is # edited self.DrawingSurface.SetCursor(wx.StockCursor(wx.CURSOR_CROSS)) self.Redraw()
def on_cursor_enter(self, event): self.saved_cursor = self.figure.canvas.GetCursor() self.figure.canvas.SetCursor(wx.StockCursor(wx.CURSOR_CROSS))
def _CursorChangedEvent(self, obj, evt): cur = self._cursor_map[obj.GetCurrentCursor()] if IsNotWX4(): c = wx.StockCursor(cur) else: c = wx.Cursor(cur) self.SetCursor(c)
def HideCursor(self): if IsNotWX4(): c = wx.StockCursor(wx.CURSOR_BLANK) else: c = wx.Cursor(wx.CURSOR_BLANK) self.SetCursor(c)
def ShowCursor(self): rw = self._Iren.GetRenderWindow() cur = self._cursor_map[rw.GetCurrentCursor()] if IsNotWX4(): c = wx.StockCursor(cur) else: c = wx.Cursor(cur) self.SetCursor(c)
def viewport_mouse_right_down(self, event): if not self._camera: return if not self._world: return self._mouse_state = MouseState.MOVE self.Viewport.SetCursor(wx.StockCursor(wx.CURSOR_SIZING)) self._move_last_pos = event.GetPosition()
def viewport_mouse_right_up(self, event): if not self._camera: return if not self._world: return self._mouse_state = MouseState.NONE self.Viewport.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
def set_viewport_cursor(self, stock_cursor): self.Viewport.SetCursor(wx.StockCursor(stock_cursor))
def ResetCursors(): global CURSORS if CURSORS is None: CURSORS = [wx.NullCursor, wx.StockCursor(wx.CURSOR_HAND), wx.StockCursor(wx.CURSOR_SIZENWSE), wx.StockCursor(wx.CURSOR_SIZENESW), wx.StockCursor(wx.CURSOR_SIZEWE), wx.StockCursor(wx.CURSOR_SIZENS)]