-2

I want to write a python code to lock my keyboard for a certain amount of time. Pythoncom module didn't work or may not exist.

Rishil Antony
  • 725
  • 5
  • 5
  • We're not a code-writing website. What have you already tried? – AStopher Sep 17 '15 at 06:17
  • 1
    it has been already asked here ( for Linux ): http://stackoverflow.com/questions/10740067/how-do-i-lock-the-keyboard-to-prevent-any-more-keypresses-being-sent-on-x11-li – NKSHELL Sep 17 '15 at 06:26

1 Answers1

0

It'll be OS-specific. On Windows you may use BlockInput function available from Windows API.

import ctypes
ctypes.cdll.user32.BlockInput(True)
Łukasz Rogalski
  • 22,092
  • 8
  • 59
  • 93
  • Please ***do NOT*** answer off-topic questions, *especially* gimme-teh-codez questions like this. – AStopher Sep 17 '15 at 06:29
  • @cybermonkey You may find [a meta-discussion on the matter interesting](http://meta.stackoverflow.com/questions/288133/is-using-stack-overflow-for-gimme-codez-questions-encouraged). I strongly agree with your sentiment, but have concluded that it is a Sisyphean task unless the incentives change and there's no sign of that. – msw Sep 17 '15 at 07:48