Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def StartingKey(self, evt):
- """
- If the editor is enabled by pressing keys on the grid, this will be
- called to let the editor do something about that first key if desired.
- """
- self.log.write("MyCellEditor: StartingKey %d\n" % evt.GetKeyCode())
- key = evt.GetKeyCode()
- ch = None
- if key in [ wx.WXK_NUMPAD0, wx.WXK_NUMPAD1, wx.WXK_NUMPAD2, wx.WXK_NUMPAD3,
- wx.WXK_NUMPAD4, wx.WXK_NUMPAD5, wx.WXK_NUMPAD6, wx.WXK_NUMPAD7,
- wx.WXK_NUMPAD8, wx.WXK_NUMPAD9
- ]:
- ch = ch = chr(ord('0') + key - wx.WXK_NUMPAD0)
- elif key < 256 and key >= 0 and chr(key) in string.printable:
- ch = chr(key)
- if ch is not None:
- # For this example, replace the text. Normally we would append it.
- #self._tc.AppendText(ch)
- self._tc.SetValue(ch)
- self._tc.SetInsertionPointEnd()
- else:
- evt.Skip()
Add Comment
Please, Sign In to add comment