+ 1

How to get key input python in Tkinter

I was making an AI in python and when ever I run that program, it takes too long to shut off. So if I could get an input like ‘q’ to exit. Thanks if you help out

2nd Feb 2019, 3:27 PM
Landon
Landon - avatar
1 Answer
+ 1
I don't remember tk code correctly but this should do. Google for correct syntax. tb = TextBox(...) while tb.text != 'q': # use 'if' if while can't be used do stuff # if input is q window.exit()
3rd Feb 2019, 4:14 AM
Rugved Modak
Rugved Modak - avatar