2

I am learning Python, and I have decided to make some practise by coding a mini chat in terminal, with a server and a client. But there is a problem, to make a real chat, the client must be able to type, send and receive messages in the same time like that:

//MESSAGES
>bla bla to send

So messages are scrolling while in the bottom of the shell, there's my input.

I have searched the web how to make that, maybe the multi-threading, no. The input() fonction blocks the process.

If you have an answer to my question, it'll be great! Thanks in advance!

Tiwenty
  • 733
  • 1
  • 10
  • 17
  • This response might help you http://stackoverflow.com/questions/5697305/python-command-line-input-in-a-process – samoz Aug 17 '12 at 17:38

1 Answers1

1

On Unix systems, you might want to check out curses, which is a library designed to do this type of thing. Python has a module for it in the standard library.

There is a good tutorial on using curses in the docs. This also suggests the console module for Windows users.

Gareth Latty
  • 86,389
  • 17
  • 178
  • 183