how do I make the next piece of code work?
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "Test")
self.text = wx.TextCtrl(self, -1)
self.Fit()
self.text.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Show()
def OnLeftDown(self, event):
evt = wx.KeyEvent(wx.EVT_CHAR_HOOK)
evt.m_keycode = wx.WXK_HOME
self.text.GetEventHandler().ProcessEvent(evt)
app = wx.PySimpleApp()
app.SetTopWindow(MyFrame())
app.MainLoop()
what I need is something like:
enter some text, press the left button and the cursor goes at home position via a keyevent.
This is a concept question... I need the keyevent posted/handled not something like:
self.text.SetInsertionPoint(0)
Thanks in advance.
···
--
Peter Damoc
Hacker Wannabe
http://www.sigmacore.net/