Pygame - "error: Display Surface Quit"
I've made a menu screen where clicking on a button leads to a different screen in the same window. def main(): import pygame, random, time pygame.init() size=[800, 600
Solution 1:
Several possibilities:
- end the process (with e.g.
sys.exit()
) in theview
function. Not ideal. - return a value from the
view
function to indicate that the application shoud end (e.g.return done
), and check for that return value in themain
function (if done: return
). Better. - make
done
global and check for its value in themain
function. I really would not like this solution. - my favourite: avoid multiple event loops altogether, so the problem solves itself (so you could just e.g. exit the
main
function with return).
Post a Comment for "Pygame - "error: Display Surface Quit""