Idea: get input() to display modal dialog to enter text



  • Would it be possible, when DrawBot encounters input() or raw_input(), to have it display a modal dialog to obtain a string from the user, rather like prompt() in JavaScript? This would be a super easy way of getting input from a user, and would allow code to be reused on the command line.

    I ran the idea past Frederik and he suggested trying Variable(). Compare:

    print ("What is the sample text?")
    Variable([
        dict(name="sampleText", ui="EditText")
        ], globals())
    print (sampleText)
    

    with…

    sampleText = input("What is the sample text?")
    print (sampleText)
    

    I know I’ll never remember the first construction 😞 The Variable() dialog hangs around even after I have got the user input, which isn’t a nice experience. When the user closes the dialog, it’s gone forever.


Log in to reply