operating system - Get Key Code of Pressed Key from Python -


is possible python read key (such enter or escape or arrow key) pressed user , record keycode of key in variable?

i looked @ python key binding/capture displays character press in shell. want record value in variable, no need print (and not python '\n' enter real keycode (like 13 think on windows) enter key).

this works me. @mosherabaev right , code version. guess have find characters special keys (like '\r' enter). no clue characters arrow keys though...

import wx user_input = str(raw_input())  user_input += '\r' #if press enter key print user_input  if ord(user_input) == wx.wxk_return:         print "hey" print "what" 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

c# - MSDN OneNote Api: Navigate to never before opened page without opening a OneNote Application Window -