0

The following keybindings are working fine on Windows, but don't execute the bound code on Mac. Are the keybindings different between Windows, Mac and Linux?

 self._kw.keyboard_win.bind("<Shift-KeyPress-Left>", self._on_shift_cursor_left) self._kw.keyboard_win.bind("<Shift-KeyPress-Right>", self._on_shift_cursor_right) self._kw.keyboard_win.bind("<Shift-KeyRelease-Left>", self._on_shift_cursor_left) self._kw.keyboard_win.bind("<Shift-KeyRelease-Right>", self._on_shift_cursor_right) 

I tried a few alternatives, based on information I saw in similar questions.

For example:

"<Shift_L-KeyPress-Left>" "<KeyPress-Shift_L-Left>" 

These caused errors to be raised from tk.

I am able to bind to <KeyPress-Shift_L> or <KeyPress-Left>, but I want the combination of 'Shift and Left' and 'Shift and Right'.

ALL: I deleted the text of my keybinding strings and re-typed them, and now the bindings are working on all platforms (Mac, Win, and Linux). So, there must have been something (hidden) that the Mac version didn't like. Sorry for having not tried that before posing my question.

4
  • While there are differences on modifier keys, Shift were never be an issue. What have your tried to debug this ? For example have you looked into event.state and have you tried to bind Shift-Keypress Commented Apr 1, 2024 at 18:32
  • 2
    <Shift-KeyPress-Left> and <Shift-Left> both work on my mac. Commented Apr 1, 2024 at 18:37
  • In my _on_shift_cursor_left and _on_shift_cursor_right functions, I test the event.state to see if it was a press or release, and start or end some processing as a result. This works fine on Windows and Linux, but the event handler never gets called when run on my Mac. That is why I tried some alternative bindings (with no luck) and posted this question. Commented Apr 2, 2024 at 19:44
  • @BryanOakley - I deleted my strings and re-typed them, and now it is working on my Mac (as well as on Win and Linux). Commented Apr 2, 2024 at 20:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.