Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@eliotb
Copy link
Contributor

@eliotb eliotb commented Mar 5, 2020

Improves experience for users that only have numpad/keypad movement keys, lacking standalone versions of same.

for i in kmap:
def mfunc(event, key=i):
self.event_generate(kmap[key], **{'state': event.state})
self.bind(i, mfunc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Windows it gives me _tkinter.TclError: bad event type or keysym "KP_Left". Numpad left keycode is just Left in Windows. You should catch and silence the binding errors.

I'm also worried that on some platforms this approach may generate double movement actions (one for KP_Left and another for generated Left). The standard approach is ending the event handler with return "break" -- this should stop the event propagation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please add link to the issue as comment inside bind_keypad!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new pull request rebased and squashed onto current master branch.

@aivarannamaa
Copy link
Member

Thank you for the contribution! Please see my comments in the code!

@aivarannamaa
Copy link
Member

BTW. Do you have IDLE installed? Does your numpad movement keys work there?

Which Tk version do you have? ("Thonny => Help => About" and "IDLE => Help => About IDLE")

@eliotb
Copy link
Contributor Author

eliotb commented Mar 6, 2020

BTW. Do you have IDLE installed? Does your numpad movement keys work there?

Just installed, and no, numpad movement doesn't work there either.

Which Tk version do you have? ("Thonny => Help => About" and "IDLE => Help => About IDLE")

Python 3.7.3, Tk 8.6.9

eliotb and others added 4 commits March 7, 2020 10:36
(I expect this to be squashed into previous)

Signed-off-by: Eliot Blennerhassett <[email protected]>
Signed-off-by: Eliot Blennerhassett <[email protected]>
(doesn't really belong in this PR, but causing CI to fail)
@aivarannamaa aivarannamaa merged commit 5064bbf into thonny:master Mar 7, 2020
@aivarannamaa
Copy link
Member

Thanks! I'll test it in my Ubuntu at work.

@eliotb eliotb deleted the keypad branch March 7, 2020 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants