What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Python help

Python help
Author: Message:
Chancer
Senior Member
****

Avatar

Posts: 648
Reputation: 7
34 / Male / Flag
Joined: May 2005
Status: Away
O.P. RE: Python help
Yeah! I did it :)
Just changes a little bit that while True loop.
Python code:
while True:
    for event in pygame.event.get():
        if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
            return
        key = pygame.key.get_pressed() # Added only to check the condition below        while key[K_UP] or key[K_DOWN] or key[K_RIGHT] or key[K_LEFT]           
            key = pygame.key.get_pressed()
           
            if key[K_UP] and key[K_RIGHT]:
                SendData('AD')
           
            elif key[K_UP] and key[K_LEFT]:
                SendData('AE')
           
            elif key[K_DOWN] and key[K_RIGHT]:
                SendData('RD')
           
            elif key[K_DOWN] and key[K_LEFT]:
                SendData('RE')
           
            elif key[K_UP]:
                SendData('Ax')
           
            elif key[K_DOWN]:
                SendData('Rx')
           
            elif key[K_RIGHT]:
                SendData('xD')
           
            elif key[K_LEFT]:
                SendData('xE')
            pygame.time.delay(10) # Added to have a better control - 10 ms between each loop            pygame.event.pump() # This makes the trick, but I don't know exactly how it works


Also, already added the command to send data via serial.
09-27-2009 10:47 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Python help - by Chancer on 09-14-2009 at 01:47 AM
RE: Python help - by Ezra on 09-14-2009 at 05:23 PM
RE: Python help - by Chancer on 09-14-2009 at 08:55 PM
RE: Python help - by Jarrod on 09-15-2009 at 08:11 AM
RE: Python help - by Chancer on 09-15-2009 at 08:45 PM
RE: Python help - by matty on 09-16-2009 at 12:36 PM
RE: Python help - by Chancer on 09-16-2009 at 05:55 PM
RE: Python help, Solution :) - by Jarrod on 09-20-2009 at 01:33 PM
RE: Python help - by Chancer on 09-20-2009 at 03:26 PM
RE: Python help - by Jarrod on 09-20-2009 at 09:40 PM
RE: Python help - by Chancer on 09-20-2009 at 10:05 PM
RE: Python help - by Jarrod on 09-20-2009 at 10:08 PM
RE: Python help - by Chancer on 09-21-2009 at 01:06 AM
RE: Python help - by Jarrod on 09-21-2009 at 01:23 AM
RE: Python help - by Chancer on 09-26-2009 at 11:20 PM
RE: Python help - by Jarrod on 09-27-2009 at 09:35 AM
RE: Python help - by Chancer on 09-27-2009 at 02:39 PM
RE: Python help - by Jarrod on 09-27-2009 at 09:12 PM
RE: Python help - by Chancer on 09-27-2009 at 10:47 PM
RE: Python help - by Chancer on 10-04-2009 at 04:05 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On