My original program used input, for example:
n = input("Enter your favorite number: ")
Now I’ve switched to GTK GUI, but still want everything to be done. Now let's look at this very similar piece of code:
n = myWindow.getNumber()
Is it possible to write a method getNumber()that returns only after the user clicks the submit button in the window? (for example, how the function works input), or this is my only option:
def callback(widget, event):
n = myWindow.inputWidget.getValue()
n = myWindow.getNumber(callback)
Update: I am looking to do this without gtk.Dialog, since I do not want the dialog to appear every time user input is required.
source
share