############################################ #Tool To show and test my animations # #Written By Derek Mcdonald # ############################################ #Released under the following liscense: # # # # i dont give a shit what you do. # ############################################ import pygame, os, sys, Global from pygame.locals import* from pgu import gui ############################################# #all the defs for buttons #faster button def fast(self): Global.FPS = Global.FPS - 10 #slower button def slow(self): Global.FPS = Global.FPS + 10 #the stop animation button def stop(self): Global.AnimationLoop = 0 #the play animation function def play(self): Global.CurrentFrame = 0 Global.AnimationLoop = 1 Global.NumberOfFrames = Global.NumberOfFrames - 1 while Global.AnimationLoop == 1: FrameData = os.path.join("Frames",Global.Frame[Global.CurrentFrame]) Frame = pygame.image.load(FrameData) if Global.CurrentFrame == Global.NumberOfFrames: Global.CurrentFrame = 0 elif Global.CurrentFrame < Global.NumberOfFrames: Global.CurrentFrame = Global.CurrentFrame + 1 Global.screen.blit(Frame,(Global.AniX,Global.AniY)) pygame.display.flip() pygame.time.delay(Global.FPS) #update the event checker for e in pygame.event.get(): app.event(e) #exit button def Exit(self): exit() ############################################# ############################################# #main loop while Global.MainLoop == 1: app = gui.Desktop() app.connect(gui.QUIT,app.quit,None) main = gui.Container(width=640, height=480) #initialize the main widget app.init(widget= main, screen = Global.screen) #################################################################### #Make all the buttons PlayButton = gui.Button("Play",width = 50) main.add(PlayButton,5,455) PlayButton.connect(gui.CLICK,play,None) StopButton = gui.Button("Stop",width = 50) main.add(StopButton,70,455) StopButton.connect(gui.CLICK,stop,None) FastButton = gui.Button("Faster",width = 75) main.add(FastButton,135,455) FastButton.connect(gui.CLICK,fast,None) SlowButton = gui.Button("Slower",width = 75) main.add(SlowButton,225,455) SlowButton.connect(gui.CLICK,slow,None) ExitButton = gui.Button("Exit",width = 50) main.add(ExitButton,580,0) ExitButton.connect(gui.CLICK,Exit,None) ####################################################################### #update the event checker for e in pygame.event.get(): app.event(e) app.run(main)