Re: [pygame] Pygame and Ibus
I always include 'import sys' at the top, so that after I call pygame.quit(), I can call sys.exit() which can sometimes stop the program from hanging. On Fri, Apr 12, 2013 at 8:04 AM, Mathieu Dubois wrote: > Hello, > > I am using Pygame (1.9.1release) under Ubuntu (12.04). I have noticed that > when sometimes when I quit my program (with pygame.quit()) the Ibus (which > is related to input handling) component crashes. > > My program is essentially a psychological experiment: it displays some > stimuli and wait for user input. If the user presses the 'ESC' key, the > program raises an exception. The pygame.quit() function is called in the > finally block. > > I wanted to know if this is known issue or if I am doing something wrong. > I can try to work on a MWE if needed. > > Thanks in advance, > Mathieu > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln
Re: [pygame] Fonts
To me, it sounds like the file doesn't have the correct format. Are you sure its right? On Sun, Feb 24, 2013 at 12:25 PM, Ian Mallett wrote: > Put it into some data folder relative to your project, not inside the > PyGame system folder. > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln
Re: [pygame] Alternate to graphics modules
That kind of answer is what I wanted. Thank you! On Wed, Feb 6, 2013 at 3:29 PM, Ian Mallett wrote: > On Wed, Feb 6, 2013 at 4:20 PM, Richard Jones wrote: > >> You'd better start writing then :-) >> > At some level, you need to interface with the graphics drivers. Since > Python is an abstraction layer over C, this means either writing in C (not > Python), or using a package that does that for you. You *must* use some > package in Python to do low-level graphics--whether you write it yourself > or no. > > For a *package* that gives you low-level access, my recommendation is > PyOpenGL. It's lower-level than PyGlet and much cleaner, I think. > > Ian > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln
Re: [pygame] Alternate to graphics modules
Not to be picky, but I want to do it completely without internet installed modules. On Wed, Feb 6, 2013 at 3:17 PM, Julian wrote: > On 02/06/2013 06:12 PM, Elias Benevedes wrote: > >> There must be a way to write it in pure python code for the fact that >> pygame uses python (I assume?). >> > Pygame does not use Python for the low-level stuff. It's mostly a > front-end for SDL, which is in C. > > Like Richard suggested, try Pyglet. That is written entirely in Python > (and that's a really nice thing, because that means it works with PyPy). > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln
Re: [pygame] Object not moving!
Explicit, please? I'm not very good at riddles... On Thu, Dec 6, 2012 at 7:31 PM, Tanner Johnson wrote: > I'm the 'point me in the right direction' type, so here's a vague > description of where to go to fix this bug. If you want a more explicit > answer, let me know! > > Take a look at the line where you're blitting the image and look at your > inputs to that function. There's a problem there. Take a look at the blit > documentation and see what you can do to fix it. > > Once you resolve that, you'll see a second bug, but the answer to that one > should be pretty easy to figure out. > > Happy pygaming! > > > On Thu, Dec 6, 2012 at 6:59 PM, Elias Benevedes > wrote: > >> Hello everyone! I was having a little bug in my program. I HAVE NO IDEA >> WHY! I put print statements everywhere to check to make sure everything was >> being executed. Here is my code: >> >> import pygame, sys >> from pygame.locals import * >> >> pygame.init() >> >> screen = pygame.display.set_mode((640,480)) >> >> class goodGuy(pygame.sprite.Sprite): >> def __init__(self): >> pygame.sprite.Sprite.__init__(self) >> self.image = pygame.image.load('goodGuy.png') >> self.rect = self.image.get_rect() >> def up(self): >> print 'up' >> self.rect[1] -= 10 >> def down(self): >> print 'down' >> self.rect[1] += 10 >> def right(self): >> print 'right' >> self.rect[0] += 10 >> def left(self): >> print 'left' >> self.rect[0] -= 10 >> Guy = goodGuy() >> >> while True: >> for event in pygame.event.get(): >> if event.type == pygame.KEYDOWN: >> if event.key == K_UP: >> Guy.up() >> print 'Up' >> if event.key == K_DOWN: >> Guy.down() >> print 'Down' >> if event.key == K_RIGHT: >> Guy.right() >> print 'Right' >> if event.key == K_LEFT: >> Guy.left() >> print 'Left' >> if event.key == K_ESCAPE: >> pygame.quit() >> sys.exit() >> screen.blit(Guy.image, Guy.rect, Guy.rect) >> pygame.display.update() >> >> All that I want to happen is that for each respective arrow key, I want >> to move the image 10 pixels in that direction. Any help? >> >> >> -- >> "The validity of internet quotes are getting sketchy nowadays" >> -Abraham Lincoln >> >> > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln
[pygame] Re: Re-Blitting of already blitted items
The only problem is, every time the function runs (Inside the main while loop), the might be a change to the list. If there is, I want it to blit the new item, but not move anything other than that. I guess I didn't explain enough. On Wednesday, November 28, 2012, Al Sweigart wrote: > Hey Elias. Sure, after your "screen.fill(White)" line, you want to add a > call to a function like drawImagesInList(allpots). (Then get rid of the for > loop after it.) > > You'll want to define the drawImagesInList() function this: > def drawImagesInList(listOfImages): > curx = 0 > for im in listOfImages: > surface.blit(im, (curx, 0)) > curx += 50 > > Now you can pass drawImagesInList() a list of pygame.image objects and it > will automatically draw them across the screen. > > -Al > > > On Wed, Nov 28, 2012 at 8:41 PM, Elias Benevedes > 'benevedesel...@gmail.com');> > > wrote: > >> Hello everyone >> >> I was wondering if there was a way to make it so that you have items in a >> list representing images, a function adding to that list. Then, you have a >> function adding to that list. Then, you have a for loop blitting each of >> those pictures onto a surface, and adding 50 pix to the x amount for each >> iteration. The only problem is, every time the for loop iterates, every >> frame, it adds 50 to the x amount AND re-blits the picture, moving it 50 >> pix to the right. I want to make it so that every time the for loop >> iterates, it checks to see if that item has already been blitted. If it >> has, don't re blit it. If not, blit it 50 pix to the right of the >> previously blitted image. Here is the code, if nothing above made sense to >> you ( I tend to ramble): >> >> import pygame, sys >> from pygame.locals import * >> >> pygame.init() >> >> def loadImage(image, posx, posy): >> screen.blit(image, (posx, posy)) >> >> screen = pygame.display.set_mode((640,480),0) >> healthpot = pygame.image.load('Health.png') >> manapot = pygame.image.load('Mana.png') >> pygame.display.set_caption('Inventory test') >> White = (255,255,255) >> allpots = [manapot, healthpot] >> curx = 0 >> cury = 0 >> >> while True: >> for event in pygame.event.get(): >> if event.type == pygame.QUIT: >> pygame.quit() >> sys.exit() >> screen.fill(White) >> #screen.blit(healthpot, (0,0)) >> #screen.blit(manapot, (50, 0)) >> for i in allpots: >> loadImage(i, curx, cury) >> curx += 50 >> pygame.display.flip() >> >> >> >> -- >> "The validity of internet quotes are getting sketchy nowadays" >> -Abraham Lincoln >> >> > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln
Re: [pygame] Redesigning the pygame.org website
I would love (if this really got going) to just give some ideas. I'm not a real coder, except in python/pygame of course. On Mon, Sep 17, 2012 at 2:34 PM, Winter wrote: > On 9/17/2012 2:50 PM, Al Sweigart wrote: > >> Hi everyone. Does anyone know of people who want to redesign the >> Pygame.org website? It seems like getting a facelift could help it out a >> lot. >> >> -Al >> > > I've been doing a lot of antispam work on the site, but I'm not really a > web designer. I'm a security specialist...I'm in if my skillset could be > put to use. > > > William Fielder (Winter) > -- "The validity of internet quotes are getting sketchy nowadays" -Abraham Lincoln