1

I'm creating an IRC bot and I want to be able to constantly receive from my buffer, but at the same time if I type a command into the console I want it to be readily accepted. So far I have a infinite loop that constantly checks the input buffer of the IRC server, but I don't know how I can receive input from the console without freezing everything else.

Link
  • 76
  • 1
  • 11

1 Answers1

3

The best thing to do in this case is to use some sort of UI library that contains an event loop. You poll this event loop for things that happen including keys pressed and mouse clicks.

If you want to do this in a terminal, there is Urwid. If you want to do it as a GUI there are tons of systems available, like:

  • Gnome
  • GTK
  • KDE
  • Tcl/Tk
  • Qt4
  • Kivy

And more of them, and then loads more which aren't cross-platform.

Nick Cox
  • 35,529
  • 6
  • 31
  • 47
Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251