Dec-12-2017, 03:47 PM
My boiler plate for pygame is a small project.
It contains scene flipping , tick timer builtin to scenes, and has widgets.
Only tested in python 3.6 on Antergos(Arch linux).
Any improvements suggestion are welcome.
Code on github
sample code.
It contains scene flipping , tick timer builtin to scenes, and has widgets.
Only tested in python 3.6 on Antergos(Arch linux).
Any improvements suggestion are welcome.
Code on github
sample code.
# *** *** Open a basic Screen with a Scene *** *** # just import the basics import pygame from pyscene import Scene, Screen # inherit Scene allows the class to interface with Screen class MyScene(Scene): # where all draw commands go def blit(self, surface): surface.fill((0,0,40)) # where all event go def event(self, event): if event.type == pygame.QUIT: Screen.close() if __name__ == '__main__': # The Screen will handle pygame.init() and pygame.quit() # let create a Screen Screen.open('Basic Screen', (800, 600)) # let add a scene to Screen Screen.scenes['MyScene'] = MyScene() # let the action begin Screen.loop('MyScene', 30) # start scene, frame per seceond
99 percent of computer problems exists between chair and keyboard.