Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pynput doesnt release ctrl after hotkey is activated #9

Closed
not-nef opened this issue Jul 2, 2022 · 7 comments · Fixed by #24
Closed

Pynput doesnt release ctrl after hotkey is activated #9

not-nef opened this issue Jul 2, 2022 · 7 comments · Fixed by #24
Labels
bug 🐞 Something isn't working hotkeys ⌨️

Comments

@not-nef
Copy link
Member

not-nef commented Jul 2, 2022

Which results in the function getting executed everytime the key gets pressed without ctrl after the hotkey has been activated once

@not-nef not-nef added the bug 🐞 Something isn't working label Jul 2, 2022
@not-nef
Copy link
Member Author

not-nef commented Jul 2, 2022

I have no idea how to fix this

@not-nef not-nef added the not planned ❌ This will not be worked on label Jul 2, 2022
@not-nef
Copy link
Member Author

not-nef commented Jul 2, 2022

So hotkeys will probably become an experimental feature once the settings window is implemented

@not-nef not-nef closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2022
@rdbende
Copy link

rdbende commented Jul 3, 2022

Just wondering, why do you use pynput instead of Tkinter bindings?

@not-nef
Copy link
Member Author

not-nef commented Jul 3, 2022

@rdbende do they support multiple keys? And if yes pls tell me how i use them

@rdbende
Copy link

rdbende commented Jul 3, 2022

Do they support multiple keys?

Yes! Events and binds are absolutely one of the most powerful features of Tkinter.

For a multi-key binding you can simply use a hypen - as a separator between the keys.
Ctrl+o for example: .bind("<Control-o>", handler)

But the code above wouldn't really work, as you have to bind every single widget in the app to make it global. Instead you can use the bind_all method, which will bind the entire application.
.bind_all("<Control-o>", handler)

However, there's still a more elegant approach. You can use the event_add method to associate a global keyboard event with a global virtual event that you can bind later.

root.event_add("<<Open>>", "<Control-o>")
root.bind("<<Open>>", handler)

@not-nef
Copy link
Member Author

not-nef commented Jul 3, 2022

Thank you sooooo much!! ❤️

@not-nef not-nef reopened this Jul 3, 2022
@not-nef not-nef removed the not planned ❌ This will not be worked on label Jul 3, 2022
@not-nef not-nef added this to the 0.4 milestone Jul 5, 2022
@Moosems
Copy link
Member

Moosems commented Jul 6, 2022

Yeah. Tkinter bindings are super easy to use and make life much easier

@not-nef not-nef linked a pull request Jul 13, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working hotkeys ⌨️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants