textwidget.tag_bind("name", "<Any-KeyPress>", self.donothing) not working

Steve Holden steve at holdenweb.com
Tue Oct 25 19:33:17 EDT 2005


shannonl wrote:
> Hi all,
> 
> For some reason this bind is calling the donothing function, like it
> should, but is then allowing the text to be inserted into the Text
> widget.
> 
> Here is the code:
> 
> self.framebody.tag_config("name", underline=1)
> self.framebody.tag_bind("name", "<Any-KeyPress>", self.donothing)
> 
> line = '\t%s' % ('sometext')
> self.framebody.insert(END, line, "name")
> 
> def donothing(self):
>     return 'break'
> 
> This donothing function should keep the tcl bind from inserting the
> text...at least so I thought.
> 
> This bind does work on the text widget as a whole, but on a individual
> tag, it does not.
> 
> Can anyone help me out with this?
> 
> Thanks in advance,
> Shannon
> 
Have you tried capturing the KeyRelease events as well?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list