0

So it seems like every time I run pygame, it crashes when I try to add graphics. For example, this code works:

import pygame, sys
pygame.init()
screen = pygame.display.set_mode([640, 480])
#screen.fill([255,255,255])
#pygame.draw.circle(screen, [255,0,0],[100,100], 30, 0)
pygame.display.flip()
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
pygame.quit()

However, when i remove the pound signs, the pygame window will flash open and then close immediately and a crash report appears. Python doesn't identify any errors in my code either. Can someone please point out why having the screen.fill and the pygame.draw lines causes pygame to crash.

Im using a mac and python 2.7.9

  • 1
    I cannot replicate the error; the code works perfectly fine. If you do `print pygame.init()` do you get `(6, 0)`? If not then some modules are not initialized properly. You could try narrow down the problem even further; maybe just one of those functions are causing the issue? You might try download pygame and Cython (dependency) again? Have you tried running it in debug mode? What happens then? – Ted Klein Bergman Oct 17 '16 at 16:18
  • What crash report ? What is in this report ? You didn't show (in question) probably the most important information. – furas Oct 18 '16 at 06:01
  • Its the mac IOs crash report telling me Python "unexpectedly quit" – Joshua Kemp Oct 19 '16 at 13:49
  • @TedKleinBergman Klein, yah i got the value (6,0) and what is Cython? – Joshua Kemp Oct 19 '16 at 13:53
  • @JoshuaKemp It's a module which I thought was required for Pygame but my memory may have forsaken me. – Ted Klein Bergman Oct 19 '16 at 15:33
  • @TedKleinBergman I've never heard of it, and I'm using the Hello World Python Textbook, which isn't talked about in the book at all. Is it a Mac only thing? – Joshua Kemp Oct 21 '16 at 12:54
  • I'm using a mac and I don't have this problem. Seems very weird... Have youtried the other things I mentioned, like running in debug mode? It might be a problem with the IDE? What IDE are you using? Pycharm? – Ted Klein Bergman Oct 21 '16 at 12:59
  • @TedKleinBergman Im using IDLE as my shell if thats what your looking for. – Joshua Kemp Oct 21 '16 at 13:06
  • I've experienced much issue with that IDE (and know others that have too) so it might be the problem. Try switching to another one and it might solve it. I recommend Pycharm; it's free and offers much functionallity compared to IDLE – Ted Klein Bergman Oct 21 '16 at 13:13

0 Answers0