[Twisted-Python] how to get the user's input

Jean-Paul Calderone exarkun at divmod.com
Tue Dec 2 09:11:01 EST 2008


On Tue, 2 Dec 2008 21:38:18 +0800, lei ren <reynold.lei at gmail.com> wrote:
>hello ,everybody:
>   i am a new to use the twisted. i woul'd like to complete a WEBGAME with
>it.but i have a problem for the twisted
>i have complete the server ,and the simple client.but ,i want to the client
>have more function. one is let the usr input some command to the server
>but when i write the code ,i found it's hard ,if i want to get the user's
>input with raw_input() in a while loop,but it will block to wait the user'
>input
>what can i do for this .use thread? of twisted have some more power feature
>for the problem,,thank you every body
>
>ps:the problem like a MUD game ,user can send the command to the server and
>reveive the message from server .and the user can send command everytime
>

The way to read from stdin without blocking the reactor is to use
twisted.internet.stdio.StandardIO, a transport which lets a protocol
interact with standard in and standard out.

Jean-Paul




More information about the Twisted-Python mailing list