Python Forum
[Tkinter] selecting buttons with keyboard - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] selecting buttons with keyboard (/thread-307.html)



selecting buttons with keyboard - noissue - Oct-05-2016

Hello,

my problem:

i have some simple GUI, with some text entrys, and radiobuttons
i can select on them by mouse, but i want to do it with enter key
how i can do that?


RE: selecting buttons with keyboard - j.crater - Oct-05-2016

GUI can be created with several frameworks, which one do you use?
And how do you "point" to the radio button, so you can select it with Enter then?


RE: selecting buttons with keyboard - metulburr - Oct-05-2016

You need to bind your widget with the Return string as well as the function to run when you hit enter
my_textbox.bind("<Return>", self.func_to_run)
Output:
my_textbox.bind("<Return>", self.func_to_run)



RE: selecting buttons with keyboard - noissue - Oct-05-2016

(Oct-05-2016, 12:32 PM)j.crater Wrote: GUI can be created with several frameworks, which one do you use?
And how do you "point" to the radio button, so you can select it with Enter then?
its Tkinter
if i want it fast im just going with "Tab"

(Oct-05-2016, 12:43 PM)metulburr Wrote: You need to bind your widget with the Return string as well as the function to run when you hit enter
my_textbox.bind("<Return>", self.func_to_run)
this looks like this
there is 2 radiobuttons
and START button with take value from 1 or 2 radio button
i want to go through the menu and select things with '<return>' and later want to START app with same '<return>' also