If you just want to get the state you can use
local inst = mc.mcGetInstance()
local hIo, rc = mc.mcIoGetHandle(inst, "Keyboard/Enable")
if (rc == 0) then
local KbdState = mc.mcIoGetState(hIo)
end
wx.wxMessageBox(tostring(KbdState)) -- 0 = Off, 1 = On Just a test to show returned code
code for the example in video is as posted, nothing more or less, well apart from missing local inst = mc.mcGetInstance() at the beginning.
DazTheGas