本文整理匯總了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()