Computer Science Canada Pygame Crashing |
Author: | Nathan4102 [ Wed Apr 10, 2013 2:53 pm ] | ||
Post subject: | Pygame Crashing | ||
I'm trying to practice GUIs with Pygame, but every time I run my program, it crashes. I'm using WING IDE 4.1.12, Python 2.7, and Pygame 1.9.1, for Python 2.7. Anyone know what the error could be? The shell isn't telling me anything, it stays blank. Here's my code, and a picture of the program. If anyone could let me know what the problem is, that't be great! And yes, I do have cars.jpg in the directory of GUITest.py.
![]() |
Author: | Zren [ Wed Apr 10, 2013 3:40 pm ] |
Post subject: | RE:Pygame Crashing |
Pretty sure it's because it didn't exit cleanly with pygame.quit(). It's also probably because you didn't call pygame.init() either. http://www.pygame.org/wiki/FrequentlyAskedQuestions#In%20IDLE%20why%20does%20the%20Pygame%20window%20not%20close%20correctly? |
Author: | Nathan4102 [ Wed Apr 10, 2013 4:18 pm ] | ||
Post subject: | RE:Pygame Crashing | ||
Alright, I fixed that, and its still not working right. When I hover over the run window, i get the windows 7 loading cursor, and the window seems to be unresponsive. Also, the picture isn't loading onto the screen, yet no error message shows.
|
Author: | ishidon [ Wed Apr 10, 2013 5:11 pm ] | ||
Post subject: | Re: Pygame Crashing | ||
When making games, you always want to have everything in a loop. This should work...
|
Author: | Nathan4102 [ Wed Apr 10, 2013 5:20 pm ] | ||||
Post subject: | Re: Pygame Crashing | ||||
ishidon @ Wed Apr 10, 2013 6:11 pm wrote: When making games, you always want to have everything in a loop.
This should work...
Awesome, works perfectly! One thing though, in this piece of code:
How exactly would I trigger this? Would I have to made a statement that says "If something happens, then this event is a QUIT type event"? Thanks for the help, this is my first day with python GUIs :p Nathan |
Author: | ishidon [ Wed Apr 10, 2013 5:23 pm ] | ||
Post subject: | Re: Pygame Crashing | ||
No all you do is press the Close button in the top right corner and this will return True. |
Author: | Nathan4102 [ Wed Apr 10, 2013 5:25 pm ] |
Post subject: | RE:Pygame Crashing |
Ah, havn't done buttons yet. Ill get to that soon. Thanks! |