in reply to Re^4: need a popup gui stdin
in thread need a popup gui stdin
diamondsandperls:
Remember that Tk (and, as far as I understand, any GUI) is an event-driven system. Once program execution enters the MainLoop() function, the only things that count are events: Button presses, keypresses on the keyboard, mouse movements and button clicks, etc., etc. The keyboard keypresses that would normally be available via STDIN are MainLoop events. Keyboard keypresses can go to a Text widget, an Entry widget, etc., if the widget is in focus. Otherwise...
(Update: However, I think (without testingsee subsequent post) it should be possible to capture STDIN data before the MainLoop is entered provided the Tk script is launched from the command line. If it is launched via an icon click, we're back in territory unfamiliar to me.)
I know how to re-direct STDOUT and STDERR so as to make functions like print() and printf() output to, e.g., a Text box. I do not know how to do anything similar with STDIN and I am not even sure it is meaningful to talk of doing such a thing (Update: from within the MainLoop)!
Can you describe in greater detail what it is you hope to accomplish with your program? What is the nature of the data that STDIN is supposed to provide?
|
|---|