Tk events are served by explicit polling, often by blocking in tk_next_event/1 . Sometimes we also want to process other events, for instance to read input from a socket. It is not obvious how to do this, because when read/1 is called and there is no input available, it will block until data comes in. During this time, however, Tk events cannot be served. The ProTcXl predicate tk_wait_input/1 helps here: tk_wait_input(Stream) will block and serve all Tk events until there is some data available in Stream. If a Prolog graphics event is encountered, the ECLiPSe event 333 will be raised. This predicate can also be easily extended to handle several inputs streams.