On Jun 30, 11:55 am, jamitwi...@gmail.com wrote:
Is there any way to type into a Tkinter frame window?
I want to use raw_input() within a Tkinter frame.
import sys
import Tkinter
import cStringIO
class GUIInputMgr(Tkinter.Entry):
def __init__(self, parent):
Tkinter.Entry.__init__(self, parent)
sys.stdin = cStringIO.StringIO()
self.bind("<Key>", self.__UpdateBuffer)
def __UpdateBuffer(self, event):
sys.stdin.truncate(0)
sys.stdin.write(self.get())
entry = GUIInputMgr(top) # top is your Tk() instance
entry.pack()
raw_input() # should now get you user input :)
Sebastian