Maya python keylogging

is there a way to log the keypresses in maya?

I’m trying to create a window in Maya with pyQt that will display the keys I am pressing.
I thought it might be handy when I am creating tutorial videos so people can actually see what I am pressing.

I have found some external options to do this, but most of them do not work as I want them to.

I already tried some options with pyHook module and Tkinter.
but I cant get the pyHook module to work propperly and Maya gives me problems importing the Tkinter module.

basic idea is while the pyqt window is open to take the key that is pressed and show it in the window.

thanks in advance

posted this in wrong thread i see :blush: can someone place it in coding? :stuck_out_tongue:

found a way to check if keyboard is pressed:

from PyQt4 import QtCore, QtGui
import maya.OpenMayaUI as mui
import sip

class KeyPressCheck(QtCore.QObject):
def eventFilter(self, obj, event):
if event.type() == 6:
print ‘keyboardpressed’
return False

MainWindow = mui.MQtUtil.mainWindow()
mainWin = sip.wrapinstance(long(MainWindow), QtGui.QMainWindow)

filter = KeyPressCheck()
mainWin.installEventFilter(filter)

Did you ever get this to work in Maya. I was thinking the same thing. Making a program to display the keys pressed like they have in Blender.

http://perryleijten.com/download/KeyBoardInputUI.rar you can download the code here, its quite messy and only works on dutch keyboards for some reason, will have to take a closer look at how the keys are bound by qt, hope this helps