[Tutor] push a keyboard button to run a function
Alan Gauld
alan.gauld at yahoo.co.uk
Fri Apr 10 19:16:44 EDT 2020
On 10/04/2020 23:11, Chris C wrote:
> I am trying to invoke a function in my python code by using a keyboard
> keystroke.
You need to tell us more.
Is this a CLI program or a GUI? If a GUI which toolkit?
Tkinter? wxPython? other...
If a CLI which OS? If it is Unix like then the curses module
is your friend.
If its Windows the msvcrt module will help.
> Alternatively, I need to change a variable's value from true to false and
> false to true everytime when I push this button,
>
variable = not variable
will toggle a boolean between true/false.
But we need more context information to answer fully.
Ideally some code (even if it doesn't work) to see what
you are attempting.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list