'Emulate waiting for input() in Tkinter
I am trying to recreate a command-line application into a desktop one using Tkinter. I cannot seem to figure out how to recreate the input() function - waiting for input and pressing Enter to confirm. Has anyone had a similar issue?
I have looked into button_pressed in Tkinter. Is there a better alternative?
Solution 1:[1]
You use a tkinter Text widget. Pressing "enter" should fire the "default" button, so you'll need a handler for that button, where you fetch the result. If this is something separate from your regular GUI, perhaps you want tkinter's simpledialog.askstring.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tim Roberts |
