raw_input into Tkinter ?

Matimus mccredie at gmail.com
Mon Jun 30 18:49:34 EDT 2008


On Jun 30, 9:55 am, jamitwi... at gmail.com wrote:
> Is there any way to type into a Tkinter frame window?
> I want to use raw_input() within a Tkinter frame.

`raw_input(prompt)` just calls `sys.stdout.write(prompt)` and returns
`sys.stdin.readline()`. So, you can just create file-like objects to
replace stdout and stdin that are aware of your Tkinter gui.
Alternatively, you could just replace __builtins__.raw_input with your
own version.

Actual implementation left as an exercise for the user.

Matt





More information about the Python-list mailing list