Program closes unexpectedly after creating Pygame window - Raspberry Pi Forums
i have program opens pygame window , tells make condition true (gpio pin high). it, then, waits click mouse. when click, window closes , checks see if condition met. if condition still isn't met, opens window again, , process should go infinitely until make condition true.
problem after loops once, program closes (i'm running in console)
here's code:
first time runs works how it's supposed to.
second time code runs, window opens shortly (with text , color), closes again , program stops.
also, have code inside own function gets called every time condition not met.
edit: code file , it's 'settings' file @ following link (it won't let me attach them):
https://www.dropbox.com/sh/lezou8mtytu6 ... ez4fbdofha
suggestions anyone?
problem after loops once, program closes (i'm running in console)
here's code:
code: select all
screen = pygame.display.set_mode([480, 640]) pygame.display.set_caption(caption) background = pygame.surface(screen.get_size()) background = background.convert() background.fill((230, 230, 230)) font = pygame.font.font(none, 75) text = font.render("click when ready...", 1, (10, 10, 10)) textpos = text.get_rect() textpos.centerx = background.get_rect().centerx textpos.centery = background.get_rect().centery background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
second time code runs, window opens shortly (with text , color), closes again , program stops.
also, have code inside own function gets called every time condition not met.
edit: code file , it's 'settings' file @ following link (it won't let me attach them):
https://www.dropbox.com/sh/lezou8mtytu6 ... ez4fbdofha
suggestions anyone?
probably more useful paste whole code file, rather snippet...
(if you're unwilling paste *whole* file, please create minimal standalone example still suffers same problem)
(if you're unwilling paste *whole* file, please create minimal standalone example still suffers same problem)
raspberrypi
Comments
Post a Comment