1

I wan't to make a program that logs keys. But is it possible to do this when the program is not focused? I only know how to do this when the program is focused.

Log keys when program is focused with pygame:

import pygame
from pygame.locals import *
import sys

pygame.init()

width, height = 300, 300

display = pygame.display.set_mode((width,  height))

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        if event.type == KEYDOWN:
            print chr(event.key)
Gewoo
  • 347
  • 5
  • 18
  • 5
    Possible duplicate of [Cross platform keylogger](http://stackoverflow.com/questions/365110/cross-platform-keylogger), also [Help with my keylogger](http://stackoverflow.com/questions/3553209/help-with-my-keylogger) – Peter Wood Nov 18 '15 at 16:20

0 Answers0