Create an input box with python
Question: I want to create a box for the user to interact with on screen.

I want to use it like this:

The program runs. A window appears. The box is somewhere in that window. And
the user can click inside with the mouse. He can type, erase, and when he is
done he will be able to press a button "ok" and I'll be able to collect the
text info written by the user in the box and use it for further purposes.

I can't find a tutorial or a reference to help me do something like that.


Answer: You could try the Tkinter module, for example:

    
    
    from Tkinter import *
    
    master = Tk()
    e = Entry(master)
    e.pack()
    
    e.focus_set()
    
    def callback():
        print e.get() # This is the text you may want to use later
    
    b = Button(master, text = "OK", width = 10, command = callback)
    b.pack()
    
    mainloop()
    

**Result:**

![Result](http://i.stack.imgur.com/rIusU.png)

Of course, you may want to read a **Tkinter** tutorial.

