From: Kevin A. <al...@se...> - 2005-02-26 16:05:50
|
On Feb 26, 2005, at 4:45 AM, Liam Clarke wrote: > Kia ora, > > I'm playing around with text fields, and I'm trying to control what a > user can type. > So, I've used the following - > > def on_TextField1_keyPress(self, event): > print 'foo' > > to test my theory. Now, I can press a key, and 'foo' will be printed > to my console all day long, but the text isn't entered in the text > field, so obviously I've overridden the default key press behaviour. > > My problem is, I can't find the default key press behaviour for a > text field widget. > I've looked in model.py, event.py, and widget.py, and if it's there, > I've missed it. (which is highly likely, I ran out of coffee > yesterday.) > > Is anyone able to point me at the right module? > > It would be much appreciated. > > Regards, > > Liam Clarke > -- > 'There is only one basic human right, and that is to do as you damn > well please. > And with it comes the only basic human duty, to take the consequences. > If you want the text to appear you need to add event.skip() on the line after your print statement. There are number of samples and tools that use keyDown, keyUp, and keyPress handlers, so you the findfiles tool to search for more examples that look at the keyCode... ka |