本文整理汇总了Python中wx.EVT_LEFT_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_LEFT_DOWN属性的具体用法?Python wx.EVT_LEFT_DOWN怎么用?Python wx.EVT_LEFT_DOWN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_LEFT_DOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, parent, id):
style = wx.WANTS_CHARS | wx.FULL_REPAINT_ON_RESIZE | wx.NO_BORDER
wx.Control.__init__(self, parent, id, style = style)
self.panel = parent
wx.EVT_SIZE(self, self.OnSize)
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_LEFT_UP(self, self.OnLeftUp)
wx.EVT_LEFT_DCLICK(self, self.OnLeftDown)
wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
wx.EVT_CHAR(self, self.OnKeyChar)
self.createEmptySp()
self.updateScreen(redraw = False)
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, parent, widgetInfo, *args, **kwargs):
super(RadioGroup, self).__init__(parent, *args, **kwargs)
self._parent = parent
self.info = widgetInfo
self._id = widgetInfo['id']
self._options = widgetInfo['options']
self.widgetInfo = widgetInfo
self.error = wx.StaticText(self, label='')
self.radioButtons = self.createRadioButtons()
self.selected = None
self.widgets = self.createWidgets()
self.arrange()
for button in self.radioButtons:
button.Bind(wx.EVT_LEFT_DOWN, self.handleButtonClick)
initialSelection = getin(self.info, ['options', 'initial_selection'], None)
if initialSelection is not None:
self.selected = self.radioButtons[initialSelection]
self.selected.SetValue(True)
self.handleImplicitCheck()
self.applyStyleRules()
示例3: finish_widget_creation
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def finish_widget_creation(self, level):
WindowBase.finish_widget_creation(self, level)
if self.CHILDREN: # not for MenuBar, ToolBar
self.drop_target = clipboard.DropTarget(self)
self.widget.SetDropTarget(self.drop_target)
self.widget.SetMinSize = self.widget.SetSize
if self.has_title:
self.widget.SetTitle( misc.design_title(self.title) )
elif hasattr(self.widget, 'SetTitle'):
self.widget.SetTitle(misc.design_title(self.name))
self.widget.Bind(wx.EVT_LEFT_DOWN, self.drop_sizer)
self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
self.widget.Bind(wx.EVT_CLOSE, self.hide_widget)
if wx.Platform == '__WXMSW__':
# MSW isn't smart enough to avoid overlapping windows, so at least move it away from the 3 wxGlade frames
self.widget.Center()
示例4: create_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
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?
示例5: destroy_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
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)
示例6: create_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def create_widget(self):
if self.IS_TOPLEVEL:
# "top-level" menubar
self.widget = wx.Frame(None, -1, misc.design_title(self.name))
self.widget.SetClientSize((400, 30))
self._mb = wx.MenuBar()
self.widget.SetMenuBar(self._mb)
self.widget.SetBackgroundColour(self._mb.GetBackgroundColour())
import os
icon = compat.wx_EmptyIcon()
xpm = os.path.join(config.icons_path, 'menubar.xpm')
icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
self.widget.SetIcon(icon)
self.widget.Bind(wx.EVT_CLOSE, lambda e: self.hide_widget())
else:
if wx.Platform=="_WXMAC__": return # XXX check how a toplevel menu bar behaves on Mac OS
self.widget = self._mb = wx.MenuBar()
if self.parent.widget: self.parent.widget.SetMenuBar(self.widget)
if wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__':
self.widget.SetFocus = lambda : None
self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
self.set_menus() # show the menus
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, parent, plugin):
self.parent = parent
wx.Panel.__init__(self, parent)
if plugin.moveOnDrag:
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
if plugin.iconizeOnDoubleClick:
self.Bind(wx.EVT_LEFT_DCLICK, self.OnCmdIconize)
self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
self.menu = menu = wx.Menu()
item = wx.MenuItem(menu, wx.NewId(), "Hide")
menu.AppendItem(item)
menu.Bind(wx.EVT_MENU, self.OnCmdIconize, item)
item = wx.MenuItem(menu, wx.NewId(),"Close")
menu.AppendItem(item)
menu.Bind(wx.EVT_MENU, self.OnCmdClose, item)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, *args, **kwargs):
wx.Slider.__init__(self, *args, **kwargs)
self.player_ctrl = args[0]
self.Bind(wx.EVT_LEFT_DOWN, self.event_left_down)
self.Bind(wx.EVT_LEFT_UP, self.event_left_up)
self.timer_interval = 500
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.event_timer)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, *args, **kwargs):
self.timer_interval = 500
self.player_ctrl = args[0]
wx.Slider.__init__(self, *args, **kwargs)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_LEFT_DOWN, self.event_left_down)
self.Bind(wx.EVT_LEFT_UP, self.event_left_up)
self.Bind(wx.EVT_TIMER, self.event_timer)
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, parent, id, getCfgGui):
wx.Window.__init__(self, parent, id, size = (TAB_BAR_HEIGHT, TAB_BAR_HEIGHT))
self.getCfgGui = getCfgGui
self.fsImage = getBitmap("resources/fullscreen.png")
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_LEFT_DOWN(self, self.OnMouseDown)
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def __init__(self, parent):
wx.Window.__init__(self, parent, -1)
self.selected = None
# all valid characters
self.chars = ""
for i in xrange(256):
if util.isValidInputChar(i):
self.chars += chr(i)
self.cols = 16
self.rows = len(self.chars) // self.cols
if len(self.chars) % 16:
self.rows += 1
# offset of grid
self.offset = 5
# size of a single character cell
self.cellSize = 32
# size of the zoomed-in character boxes
self.boxSize = 60
self.smallFont = util.createPixelFont(18,
wx.FONTFAMILY_SWISS, wx.NORMAL, wx.NORMAL)
self.normalFont = util.createPixelFont(self.cellSize - 2,
wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)
self.bigFont = util.createPixelFont(self.boxSize - 2,
wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_SIZE(self, self.OnSize)
util.setWH(self, self.cols * self.cellSize + 2 * self.offset, 460)
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
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)
示例13: _bind_events
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def _bind_events(self):
"""Bind events to various event handlers."""
self.Bind(wx.EVT_PAINT, self._on_paint)
self.Bind(wx.EVT_SIZE, self._on_size)
# self.Bind(wx.EVT_MOTION, self.on_mouse_move)
# self.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_left_down)
# self.Bind(wx.EVT_RIGHT_DOWN, self.on_mouse_right_down)
示例14: _bind_events
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def _bind_events(self):
"""
Bind panel and canvas events.
Note that key-down is bound again - this allws hotkeys to work
even if the main Frame, which defines hotkeys in menus, is not
present. wx sents the EVT_KEY_DOWN up the chain and, if the Frame
and hotkeys are present, executes those instead.
At least I think that's how that works...
See http://wxpython.org/Phoenix/docs/html/events_overview.html
for more info.
"""
# Canvas Events
self.canvas.Bind(FloatCanvas.EVT_MOTION, self.on_mouse_move)
self.canvas.Bind(FloatCanvas.EVT_MOUSEWHEEL, self.on_mouse_wheel)
self.canvas.Bind(FloatCanvas.EVT_MIDDLE_DOWN, self.on_mouse_middle_down)
self.canvas.Bind(FloatCanvas.EVT_MIDDLE_UP, self.on_mouse_middle_up)
self.canvas.Bind(wx.EVT_PAINT, self._on_first_paint)
# XXX: Binding the EVT_LEFT_DOWN seems to cause Issue #24.
# What seems to happen is: If I bind EVT_LEFT_DOWN, then the
# parent panel or application can't set focus to this
# panel, which prevents the EVT_MOUSEWHEEL event from firing
# properly.
# self.canvas.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_left_down)
# self.canvas.Bind(wx.EVT_RIGHT_DOWN, self.on_mouse_right_down)
# self.canvas.Bind(wx.EVT_LEFT_UP, self.on_mouse_left_up)
# self.canvas.Bind(wx.EVT_KEY_DOWN, self._on_key_down)
# This is supposed to fix flicker on mouse move, but it doesn't work.
# self.Bind(wx.EVT_ERASE_BACKGROUND, None)
# Panel Events
self.Bind(csel.EVT_COLOURSELECT, self.on_color_change)
示例15: add_toolitem
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LEFT_DOWN [as 别名]
def add_toolitem(
self, name, group, position, image_file, description, toggle):
before, group = self._add_to_group(group, name, position)
idx = self.GetToolPos(before.Id)
if image_file:
bmp = _load_bitmap(image_file)
kind = wx.ITEM_NORMAL if not toggle else wx.ITEM_CHECK
tool = self.InsertTool(idx, -1, name, bmp, wx.NullBitmap, kind,
description or "")
else:
size = (self.GetTextExtent(name)[0]+10, -1)
if toggle:
control = wx.ToggleButton(self, -1, name, size=size)
else:
control = wx.Button(self, -1, name, size=size)
tool = self.InsertControl(idx, control, label=name)
self.Realize()
def handler(event):
self.trigger_tool(name)
if image_file:
self.Bind(wx.EVT_TOOL, handler, tool)
else:
control.Bind(wx.EVT_LEFT_DOWN, handler)
self._toolitems.setdefault(name, [])
group.insert(position, tool)
self._toolitems[name].append((tool, handler))