Example #1
0
 def gameover(self):
     self.gameIsRunning = False  #Stop the game after gameover
     self.tk.update()
     self.play_sound(self.dir + "FlappyBird_Game/FlappyBird_Sounds/hit.mp3")
     self.play_sound(self.dir + "FlappyBird_Game/FlappyBird_Sounds/die.mp3")
     messagebox.showerror("Game over", "GAME OVER - Your Score is: %s Highscore: %s" % (self.score, \
                                               self.highscore))
     self.attemps += 1
     self.update_score()
     a = messagebox.askyesno("Game", "Do you want to continue playing?")
     if a:
         load = Tk()
         load.title("Attemp retry: %s" % self.attemps)
         ll = Label(load, text="Attemp retry: %s" % self.attemps)
         ll.pack()
         pr = t.Progressbar(load, length=150, value=0)
         pr.pack()
         vl = 0
         while vl <= 135:
             pr.config(value=vl)
             load.update()  #_idletasks()
             time.sleep(0.7)
             vl += randint(0, 35)
         l = Label(load, text="Done")
         l.pack()
         time.sleep(2)
         self.destroy()
         load.destroy()
         try:
             main(self.attemps, self.highscore,
                  self.dir)  #If the user wants to play another
             #time, it starts another time the main
         except TclError:
             pass
         except Exception as e:
             error = ErrorManager(e)
             error.showgui()
             error.mainloop()
     else:
         messagebox.showinfo("Game",
                             "See you Player - Attemps: %s" % self.attemps)
         self.save_highscore()
Example #2
0
    texts = [v1, v2, v3, v4, v5, v6, v7, v8]
    for text in texts:
        l = Label(intk, text=text)
        l.pack()
        labels.append(l)

    def com():
        messagebox.showinfo("OMGames",
                            "Have fun! And beat your highscores!",
                            master=intk)
        intk.destroy()
        return

    b = Button(intk, text="Accept Privacy and Continue", command=com)
    b.pack()
    intk.mainloop()
#======================================================<

if __name__ == '__main__':
    try:
        i = GamingIntro.Intro(dir=cd +
                              "FlappyBird_Game/")  #Normal Intro for game
        i.start_prg()
        main(1, highscore, cd)
    #except TclError:
    #	pass
    except Exception as e:  #Fetch errors
        error = ErrorManager(e)
        error.showgui()
        error.mainloop()