I'm making a chat program, but I have run across a problem: the screen only updates after input. I'm using turtle to show the chat (I know, turtle isn't really that good for this purpose, but it's very simple.)
This is the code in my loop:
while True:
ind = userlist.index(user)
if statlist[ind] == 'banned':
print('You have been banned.')
break
word = input('>>> ')
command(word)
if word != '':
chat = user + '(' + status + '): ' + word
update_room(chat)
refresh()
Pretty much everything can be ignored here, except the
word = input('>>> ')
and
refresh()
The refresh()
is what updates the turtle room.
How could I make it so that it would print out new chat, even as the user is typing? Would 2 side-by-side while loops work?
I acknowledge that my program isn't that well organized and that to fix this I will probably have to rewrite this loop. Note: I'd rather not import anything, but if an import is needed then it would be great if that module came preloaded with python.
Or another question: Is it possible to have 2 infinite while loops running side by side at the same time?