本文整理汇总了Python中wx.WXK_F2属性的典型用法代码示例。如果您正苦于以下问题:Python wx.WXK_F2属性的具体用法?Python wx.WXK_F2怎么用?Python wx.WXK_F2使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.WXK_F2属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_char
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_F2 [as 别名]
def on_char(self, event):
"called from main: start label editing on F2; skip events while editing"
keycode = event.GetKeyCode()
if keycode==wx.WXK_F2 and self.cur_widget and self.cur_widget._label_editable():
# start label editing
self.EditLabel( self.cur_widget.item )
return True
if isinstance(self.FindFocus(), wx.TextCtrl):
# currently editing
event.Skip()
return True
if keycode in (wx.WXK_UP, wx.WXK_DOWN, wx.WXK_LEFT, wx.WXK_RIGHT):
event.Skip()
return True
return False
示例2: on_char
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_F2 [as 别名]
def on_char(self, event):
# key handler for grid
if isinstance(self.grid.FindFocus(), wx.TextCtrl):
# a cell is being edited
event.Skip()
return True # avoid propagation
self.on_focus()
key = (event.GetKeyCode(), event.GetModifiers())
# handle F2 key
if key==(wx.WXK_F2,0) and self.grid.CanEnableCellControl():
#self.grid.MakeCellVisible(...)
self.grid.EnableCellEditControl(enable=True)
return True
# handle Ctrl-I, Ctrl-A, Ctrl-R; Alt-A will be handled by the button itself
if key in ((73,2),(73,1)) and self.can_insert:
# Ctrl-I, Alt-I
self.insert_row(event)
elif key in ((65,2),(68,1)) and self.can_add:
# Ctrl-A, Alt-D
self.add_row(event)
elif key==(65,1) and not self.immediate:
# Alt-A
self.apply(event)
elif key==(82,2) and self.can_remove:
# Ctrl-R
self.remove_row(event)
elif key in ((84,2),(84,1)): # Ctrl-T, Alt-T
self.reset(event)
elif key==(67,2): # Ctrl-C
if not self._copy(): event.Skip()
elif key==(86,2): # Ctrl-V
if not self._paste(): event.Skip()
elif key==(88,2): # Ctrl-X
if not self._cut(): event.Skip()
else:
#event.Skip()
return False
return True # handled
####################################################################################################################
# clipboard
示例3: _HandleChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_F2 [as 别名]
def _HandleChar(self, evt):
if evt.GetKeyCode() == wx.WXK_F2 and not self.IsCellEditing():
return self._PossibleStartCellEdit(self.GetFocusedRow(), self.GetPrimaryColumnIndex())
# We have to catch Return/Enter/Escape here since some types of controls
# (e.g. ComboBox, UserControl) don't trigger key events that we can listen for.
# Treat Return or Enter as committing the current edit operation unless the control
# is a multiline text control, in which case we treat it as data
if evt.GetKeyCode() in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER) and self.IsCellEditing():
if self.cellEditor and self.cellEditor.HasFlag(wx.TE_MULTILINE):
return evt.Skip()
else:
return self.FinishCellEdit()
# Treat Escape as cancel the current edit operation
if evt.GetKeyCode() in (wx.WXK_ESCAPE, wx.WXK_CANCEL) and self.IsCellEditing():
return self.CancelCellEdit()
# Tab to the next editable column
if evt.GetKeyCode() == wx.WXK_TAB and self.IsCellEditing():
return self._HandleTabKey(evt.ShiftDown())
# Space bar with a selection on a listview with checkboxes toggles the checkboxes
if (evt.GetKeyCode() == wx.WXK_SPACE and
not self.IsCellEditing() and
self.checkStateColumn is not None and
self.GetSelectedItemCount() > 0):
return self._ToggleCheckBoxForSelection()
if not self.IsCellEditing():
if self._HandleTypingEvent(evt):
return
if not self.IsCellEditing() and self.handleStandardKeys:
# Copy selection on Ctrl-C
# Why is Ctrl-C represented by 3?! Is this Windows only?
if (evt.GetKeyCode() == 3):
self.CopySelectionToClipboard()
return
# Select All on Ctrl-A
if (evt.GetKeyCode() == 1):
self.SelectAll()
return
evt.Skip()