本文整理汇总了Python中wx.Cursor方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Cursor方法的具体用法?Python wx.Cursor怎么用?Python wx.Cursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.Cursor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_mouse_move
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def on_mouse_move(self, event):
if not event.Dragging():
return
else:
self.SetCursor(wx.Cursor(wx.CURSOR_HAND))
if self.previous_window_position is None:
return
pos = event.GetPosition()
window_position = pos.x, pos.y
scene_position = self.convert_window_to_scene([window_position[0], window_position[1]])
sdx = (scene_position[0] - self.previous_scene_position[0])
sdy = (scene_position[1] - self.previous_scene_position[1])
wdx = (window_position[0] - self.previous_window_position[0])
wdy = (window_position[1] - self.previous_window_position[1])
if self.corner_drag is None:
self.scene_post_pan(wdx, wdy)
else:
self.perspective[self.corner_drag][0] += sdx
self.perspective[self.corner_drag][1] += sdy
self.device.perspective = repr(self.perspective)
self.previous_window_position = window_position
self.previous_scene_position = scene_position
示例2: on_mouse_middle_down
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def on_mouse_middle_down(self, event):
"""Start the drag."""
self.drag = True
# Update various positions
self.start_move_loc = np.array(event.GetPosition())
self.mid_move_loc = self.start_move_loc
self.prev_move_loc = (0, 0)
self.end_move_loc = None
# Change the cursor to a drag cursor
self.SetCursor(wx.Cursor(wx.CURSOR_SIZING))
示例3: on_mouse_middle_up
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def on_mouse_middle_up(self, event):
"""End the drag."""
self.drag = False
# update various positions
if self.start_move_loc is not None:
self.end_move_loc = np.array(event.GetPosition())
self.diff_loc = self.mid_move_loc - self.end_move_loc
self.canvas.MoveImage(self.diff_loc, 'Pixel', ReDraw=True)
# change the cursor back to normal
self.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
示例4: set_cursor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def set_cursor(self, cursor):
cursor = wx.Cursor(cursord[cursor])
self.canvas.SetCursor(cursor)
self.canvas.Update()
示例5: ChangeCursor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def ChangeCursor(self, event):
self.figure_canvas.SetCursor(wx.Cursor(wx.CURSOR_BULLSEYE))
示例6: OnMotion
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def OnMotion(self, evt):
# Ignore mouse movement if we're not dragging.
if not self.drag_shape or not evt.Dragging() or not evt.LeftIsDown():
return
# if we have a shape, but haven't started dragging yet
if self.drag_shape and not self.drag_image:
# only start the drag after having moved a couple pixels
tolerance = 2
pt = evt.GetPosition()
dx = abs(pt.x - self.dragStartPos.x)
dy = abs(pt.y - self.dragStartPos.y)
if dx <= tolerance and dy <= tolerance:
return
# refresh the area of the window where the shape was so it
# will get erased.
self.drag_shape.shown = False
self.RefreshRect(self.drag_shape.GetRect(), True)
self.Update()
item = self.drag_shape.text if self.drag_shape.text else self.drag_shape.bmp
self.drag_image = wx.DragImage(item,
wx.Cursor(wx.CURSOR_HAND))
hotspot = self.dragStartPos - self.drag_shape.pos
self.drag_image.BeginDrag(hotspot, self, self.drag_shape.fullscreen)
self.drag_image.Move(pt)
self.drag_image.Show()
# if we have shape and image then move it, posibly highlighting another shape.
elif self.drag_shape and self.drag_image:
# now move it and show it again if needed
self.drag_image.Move(evt.GetPosition())
示例7: OnMouseEvent
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def OnMouseEvent(self, e):
if e.Moving():
self.SetCursor(wx.Cursor(wx.CURSOR_HAND))
self.SetFont(self.font1)
elif e.LeftUp():
OpenWith(self.openWith, self.url)
else:
self.SetCursor(wx.NullCursor)
self.SetFont(self.font2)
e.Skip()
示例8: SetCursor
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def SetCursor(window, cursor):
window.SetCursor(wx.Cursor(cursor))
示例9: on_mouse_left_up
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def on_mouse_left_up(self, event):
self.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
self.previous_window_position = None
self.previous_scene_position = None
self.corner_drag = None
示例10: on_mouse_middle_down
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def on_mouse_middle_down(self, event):
self.SetCursor(wx.Cursor(wx.CURSOR_HAND))
self.previous_window_position = event.GetPosition()
self.previous_scene_position = self.convert_window_to_scene(self.previous_window_position)
示例11: on_mouse_middle_up
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Cursor [as 别名]
def on_mouse_middle_up(self, event):
self.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
self.previous_window_position = None
self.previous_scene_position = None