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

Python help
Author: Message:
Jarrod
Veteran Member
*****

Avatar
woot simpson

Posts: 1304
Reputation: 20
– / Male / Flag
Joined: Sep 2006
RE: Python help
well this is why I suggested pyglet over pygame, AFAIK in pygame you have an update method just like in pyglet but it needs to be inherited from a sprite object this is a sample I found on the net,
python code:
class Fist(pygame.sprite.Sprite):
    """moves a clenched fist on the screen, following the mouse"""
    def __init__(self):
        pygame.sprite.Sprite.__init__(self) #call Sprite initializer
        self.image, self.rect = load_image('fist.bmp', -1)
        self.punching = 0

    def update(self):
        "move the fist based on the mouse position"
        pos = pygame.mouse.get_pos()
        self.rect.midtop = pos
        if self.punching:
            self.rect.move_ip(5, 10)
so the problem with the code you currently have is the while True loop, and while it seems natural that that should work, it doesn't seem to work in pygame or even pyglet for that matter.
To rectify this I would create a sprite object and put your key test in the update method similar to what we did in pyglet. Were there any advantages for pygame over pyglet? When I was informed about which one to use I was told pygame might be easier but pyglet is definitely more feature rich, unless it is expected that you use pygame, you might like to consider sticking to pyglet that is if you have the choice.

This post was edited on 09-27-2009 at 01:13 PM by Jarrod.

[Image: 5344.png]
[Image: sig.png]

A.k.a. The Glad Falconer














09-27-2009 09:35 AM
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