Ive been trying to make a simple program that if i press the 'TAB' button it automatically presses 'Alt' (in a loop) Also i want it to work when python isnt the main program im using, like say a macro program.

import pygame
while True:
if pygame.K_TAB:

ye nvm im realy pretty clueless.

You need to find a way to simulate a pressed key.

I have a key simulator somewhere.

I'll search and say something when I get home.

Well you could do it like this.

while True:
    event_list = pygame.event.get()
    for event in event_list:
        if event.type == pygame.KEYDOWN and event.key == pygame.K_TAB:
            event_list.append(pygame.event.Event(pygame.KEYDOWN, {'key':pygame.K_LALT})

I think that would work

I dont think python would actually be good for this.

maybe i should be using a macro program?
Eventho i tried that and failed.

And awaiting that reply, ill try look into it some more myself in the meantime.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.