Does anyone have an example using the EmulateKeyPress
function of the wxTextCtrl.
Nigel
···
=====
---
Nigel W. Moriarty, \alphabet_soup
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
Robin
2
Nigel W. Moriarty wrote:
Does anyone have an example using the EmulateKeyPress
function of the wxTextCtrl.
import wx
class FunkyTextCtrl(wx.TextCtrl):
def __init__(self, parent, pos, size):
wx.TextCtrl.__init__(self, parent, pos=pos, size=size)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
def OnKeyDown(self, evt):
key = evt.GetKeyCode()
print chr(key)
if key != ord('X'):
evt.Skip()
return
for char in " FUNKY ":
evt.m_keyCode = ord(char)
self.EmulateKeyPress(evt)
app = wx.PySimpleApp()
frame = wx.Frame(None)
p = wx.Panel(frame)
t = FunkyTextCtrl(p, (25,25), (150,-1))
frame.Show()
app.MainLoop()
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!