Re: Tkui and Python 2.4, backspace problem

Tuomas Härkönen <[email protected]> Sun, 6 Mar 2005 16:36:24 +0200
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
On Sun, 06 Mar 2005 11:38:59 +0300, Eugene <[email protected]> wrote:
> Looks like a tk problem for me. The tkui doesn't hook the
> backspace keypress.
> 
> Does the backspace work in any other program that uses
> Tkinter?

Yes, backspace works in other programs that use Tkinter.

Why it stopped working in Lyntin, I haven't been able to figure out.
As a work-around, I added the following to the CommandEntry class in
Tkui:

self.bind("<KeyPress-BackSpace>", self.callBackSpace)
...
def callBackSpace(self, tkevent):
  """ Handles the <KeyPress-BackSpace> event."""
  bkspcIndex = self.index('insert')
  self.delete(bkspcIndex - 1, bkspcIndex)

Simple and works for now, but I'm still bummed as to why this is now necessary.

Tuomas


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click