本文整理汇总了Python中wx.WXK_SPACE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.WXK_SPACE属性的具体用法?Python wx.WXK_SPACE怎么用?Python wx.WXK_SPACE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.WXK_SPACE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def OnChar(self, event):
key = event.GetKeyCode()
if wx.WXK_SPACE == key or chr(key) in string.hexdigits:
value = event.GetEventObject().GetValue() + chr(key)
if apduregexp.match(value):
event.Skip()
return
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip()
return
if not wx.Validator_IsSilent():
wx.Bell()
return
示例2: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def OnChar(self, event):
key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip()
return
if chr(key) in string.digits:
event.Skip()
return
if not wx.Validator_IsSilent():
wx.Bell()
# Returning without calling event.Skip eats the event before it
# gets to the text control
return
示例3: OnKeyDown
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def OnKeyDown(self, event):
button = None
keycode = event.GetKeyCode()
if keycode in (wx.WXK_ADD, wx.WXK_NUMPAD_ADD):
button = self.GetNewButton()
elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
button = self.GetDelButton()
elif keycode == wx.WXK_UP and event.ShiftDown():
button = self.GetUpButton()
elif keycode == wx.WXK_DOWN and event.ShiftDown():
button = self.GetDownButton()
elif keycode == wx.WXK_SPACE:
button = self.GetEditButton()
if button is not None and button.IsEnabled():
button.ProcessEvent(wx.CommandEvent(wx.EVT_BUTTON.typeId, button.GetId()))
else:
event.Skip()
示例4: toStr
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def toStr(self):
s = ""
if self.ctrl:
s += "CTRL+"
if self.alt:
s += "ALT+"
if self.shift:
s += "SHIFT+"
if isValidInputChar(self.kc):
if self.kc == wx.WXK_SPACE:
s += "Space"
else:
s += chr(self.kc)
else:
kname = self.__class__.keyMap.get(self.kc)
if kname:
s += kname
else:
s += "UNKNOWN(%d)" % self.kc
return s
# a string-like object that features reasonably fast repeated appends even
# for large strings, since it keeps each appended string as an item in a
# list.
示例5: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def OnChar(self, event):
"""Process values as they are entered into the control
@param event: event that called this handler
"""
key = event.GetKeyCode()
if event.CmdDown() or key < wx.WXK_SPACE or key == wx.WXK_DELETE or \
key > 255 or chr(key) in Util.HEXCHARS:
event.Skip()
return
if not wx.Validator_IsSilent():
wx.Bell()
return
示例6: on_char
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def on_char(self, event):
event.Skip()
if event.GetKeyCode() == wx.WXK_ESCAPE:
self.GetParent().Close()
elif event.GetKeyCode() == wx.WXK_SPACE:
self.next()
示例7: text_inserted
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def text_inserted(self, event):
key = event.KeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip()
return
if (self.valid_chars is not None) and (chr(key) not in self.valid_chars):
return
event.Skip()
示例8: OnChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def OnChar(self, event):
key = event.KeyCode
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255:
event.Skip()
return
textCtrl = self.GetWindow()
startPos, endPos = textCtrl.GetSelection()
length = textCtrl.GetLastPosition() - (endPos - startPos)
if length >= self.maxLength:
if not wx.Validator_IsSilent():
wx.Bell()
return
if(
self.allowRaw
and textCtrl.GetInsertionPoint() == 0
and chr(key).upper() == "R"
):
textCtrl.WriteText("R")
return
if chr(key) in hexdigits:
textCtrl.WriteText(chr(key).upper())
return
if not wx.Validator_IsSilent():
wx.Bell()
# Returning without calling event.Skip eats the event before it
# gets to the text control
return
示例9: ShowInstanceChoicePopup
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [as 别名]
def ShowInstanceChoicePopup(self):
self.InstanceChoice.SetFocusFromKbd()
size = self.InstanceChoice.GetSize()
event = wx.MouseEvent(wx.EVT_LEFT_DOWN._getEvtType())
event.x = size.width // 2
event.y = size.height // 2
event.SetEventObject(self.InstanceChoice)
# event = wx.KeyEvent(wx.EVT_KEY_DOWN._getEvtType())
# event.m_keyCode = wx.WXK_SPACE
self.InstanceChoice.GetEventHandler().ProcessEvent(event)
示例10: _HandleChar
# 需要导入模块: import wx [as 别名]
# 或者: from wx import WXK_SPACE [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()