Handling keyboard events in python

前端 未结 4 1757
忘掉有多难
忘掉有多难 2021-01-27 23:01

How can I handle keyboard events in python? More exactly I need to manage keyboard arrows and some other keys for my command-line application. Is there a module for this or I ne

4条回答
  •  花落未央
    2021-01-27 23:52

    jkerian's curses suggestion is a good one, and is the one to use if you're working with Unix/Linux/etc. (which you are), but if you ever end up working in a Windows environment, then you'll definitely want to check out pywin32 and its win32con module, which wraps the Windows API's Console functions and structs.

提交回复
热议问题