I have been learning Python for just over 2 weeks. I finished my first GUI program today. It was harder to create the GUI aspect, running it from the CLI was easy!

It is simple guessing game program, where you play against the computer. You place bets, you can buy hints, and buy a game multiplier to increase the amount won.

Anyway, there are a few bugs. For example, I forgot to check to make sure the player doesn't have negative money in the bank before they place a bet, or buy a hint. Also, I think a lot of the classes are poorly named, because I was still learning the correct way to use them while writing it. But I want to post the code, and let everyone see, use it, improve it, learn from it, etc. Might keep you occupied for 15 or 20 minutes. lol. Any feedback is welcome!


__author__ = 'chrisutpg'
from tkinter import *
from tkinter import messagebox
import random
import os

class Player:
    def __init__(self, name):
        self.name = name
        self.player_bank = 5000
        self.player_wins = 0
        self.player_losses = 0
        self.player_total_guesses = 0
        self.player_record_file = ("{}Records.txt".format(name))
        if os.path.isfile(self.player_record_file):
            pass
        else:
            with open(self.player_record_file, "w") as file:
                self.write_bank = ("{}\n".format(self.player_bank))
                self.write_wins = ("{}\n".format(self.player_wins))
                self.write_losses = ("{}\n".format(self.player_losses))
                self.write_guesses = ("{}".format(self.player_total_guesses))
                file.write(self.write_bank)
                file.write(self.write_wins)
                file.write(self.write_losses)
                file.write(self.write_guesses)
        self.GetRecords()

    def GetRecords(self):
        with open(self.player_record_file, "r") as file:
            self.player_record_bank = file.readline()
            self.player_record_wins = file.readline()
            self.player_record_losses = file.readline()
            self.player_record_guesses = file.readline()
            self.player_record_bank = int(self.player_record_bank)
            self.player_record_wins = int(self.player_record_wins)
            self.player_record_losses = int(self.player_record_losses)
            self.player_record_guesses = int(self.player_record_guesses)

    def AppendRecords(self):
        self.player_append_bank = self.player_record_bank + self.player_bank
        self.player_append_wins = self.player_record_wins + self.player_wins
        self.player_append_losses = self.player_record_losses + self.player_losses
        self.player_append_guesses = self.player_record_guesses + self.player_total_guesses
        with open(self.player_record_file, "w") as file:
            write_new_bank = ("{}\n".format(self.player_append_bank))
            write_new_wins = ("{}\n".format(self.player_append_wins))
            write_new_losses = ("{}\n".format(self.player_append_losses))
            write_new_guesses = ("{}".format(self.player_append_guesses))
            file.write(write_new_bank)
            file.write(write_new_wins)
            file.write(write_new_losses)
            file.write(write_new_guesses)

    def ResetRecords(self):
        self.player_reset_bank = 5000
        self.player_reset_wins = 0
        self.player_reset_losses = 0
        self.player_reset_guesses = 0
        with open(self.player_record_file, "w") as file:
            reset_bank = ("{}\n".format(self.player_reset_bank))
            reset_wins = ("{}\n".format(self.player_reset_wins))
            reset_losses = ("{}\n".format(self.player_reset_losses))
            reset_guesses = ("{}\n".format(self.player_reset_guesses))
            file.write(reset_bank)
            file.write(reset_wins)
            file.write(reset_losses)
            file.write(reset_guesses)

class Computer:
    def __init__(self, compname):
        self.compname = compname
        self.comp_bank = 5000
        print(compname)

def GetCompName():
    RandomCompName = ["Chris", "Brianna", "Cooper", "Winston"]
    compname = random.choice(RandomCompName)
    return compname

class Game:

    def __init__(self):
        self.computer1 = Computer(GetCompName())
        self.comp_winnings1 = 0
        self.comp_winnings2 = 0
        self.comp_winnings3 = 0
        self.comp_total_winnings = 0
        self.user_winnings1 = 0
        self.user_winnings2 = 0
        self.user_winnings3 = 0
        self.user_winnings = 0

    def GetRandomNumbers(self):
        global winNum1, winNum2, winNum3, bonusNum, bonusWin
        winNum1 = random.randint(1, 5)
        winNum2 = random.randint(1, 10)
        winNum3 = random.randint(1, 15)
        bonusNum = winNum1 + winNum2 + winNum3
        bonusWin = random.randint(1, 30)
        print(winNum1, winNum2, winNum3, bonusNum, bonusWin)

    def GetMultiplyValue(self):
        global gamemultiplyer
        if bonusNum == bonusWin:
            gamemultiplyer = 10
        elif i == 7:
            gamemultiplyer = 5
        else:
            gamemultiplyer = 0
        print(gamemultiplyer)

    def GameComputer(self, computer):
        self.comp_guess1 = random.randint(1, 5)
        self.comp_guess2 = random.randint(1, 10)
        self.comp_guess3 = random.randint(1, 15)
        self.comp_bet = random.randrange(1, (computer.comp_bank - 100))
        print(self.comp_guess1, self.comp_guess2, self.comp_guess3, self.comp_bet)
        if self.comp_guess1 == winNum1:
            self.comp_winnings1 = self.comp_bet * (i + 1 + gamemultiplyer)
            computer.comp_bank = computer.comp_bank + self.comp_winnings1
        else:
            print("")
        if self.comp_guess2 == winNum2:
            self.comp_winnings2 = self.comp_bet * (i + 2 + gamemultiplyer)
            computer.comp_bank = computer.comp_bank + self.comp_winnings2
        else:
            print("")
        if self.comp_guess3 == winNum3:
            self.comp_winnings3 = self.comp_bet * (i + 3 + gamemultiplyer)
            computer.comp_bank = computer.comp_bank + self.comp_winnings3
        else:
            print("")
        self.comp_total_winnings = self.comp_winnings1 + self.comp_winnings2 + self.comp_winnings3
        if self.comp_guess1 != winNum1 and self.comp_guess2 != winNum2 and self.comp_guess3 != winNum3:
            computer.comp_bank = computer.comp_bank - self.comp_bet
        else:
            print("")
        print(computer.comp_bank)

    def GameUser(self, user):
        for i in range(1, 8):
            global i
            self.gameWindow = Tk()
            self.gameWindow.title("Round {} of 7!".format(i))
            self.gameWindow.geometry("400x300")
            self.GetRandomNumbers()
            self.GetMultiplyValue()
            user.player_total_guesses += 3
            self.display_bank = Label(self.gameWindow, text="{} you have ${} available to bet with!".format(user.name,
                                                                                                            user.player_bank))
            self.yourbetLabel = Label(self.gameWindow, text="What is your bet?")
            self.userGuessLabel1 = Label(self.gameWindow, text="Guess a number between 1 and 5:")
            self.userGuessLabel2 = Label(self.gameWindow, text="Guess a number between 1 and 10:")
            self.userGuessLabel3 = Label(self.gameWindow, text="Guess a number between 1 and 15:")
            self.userBetTK = Entry(self.gameWindow)
            self.userGuess1TK = Entry(self.gameWindow)
            self.userGuess2TK = Entry(self.gameWindow)
            self.userGuess3TK = Entry(self.gameWindow)
            self.userGuess1TK.grid(row=3, column=2, padx=5, pady=5)
            self.userGuess2TK.grid(row=4, column=2, padx=5, pady=5)
            self.userGuess3TK.grid(row=5, column=2, padx=5, pady=5)
            self.userGuessLabel1.grid(row=3, column=1, padx=5, pady=5)
            self.userGuessLabel2.grid(row=4, column=1, padx=5, pady=5)
            self.userGuessLabel3.grid(row=5, column=1, padx=5, pady=5)
            self.display_bank.grid(row=1, columnspan=2, padx=5, pady=5)
            self.yourbetLabel.grid(row=2, column=1, padx=5, pady=5)
            self.userBetTK.grid(row=2, column=2, padx=5, pady=5)
            self.submit = Button(self.gameWindow, text="Submit bet and place guesses!", command=lambda: self.GetGameInputs(start.tempName))
            self.submit.grid(row=6, columnspan=2, padx=5, pady=5)
            self.score = Button(self.gameWindow, text="Check Score!", command=lambda: self.CheckScore(start.tempName))
            self.score.grid(row=8, column=1, padx=5, pady=5)
            self.buy = Button(self.gameWindow, text="Buy A Hint!", command=lambda: self.BuyHint())
            self.buy.grid(row=7, column=1, padx=5, pady=5)
            self.buyMultiplyer = Button(self.gameWindow, text="Buy A Bigger Multiplier!", command=lambda: self.BuyMultiplyer())
            self.buyMultiplyer.grid(row=7, column=2, padx=5, pady=5)
            self.earlyexit = Button(self.gameWindow, text="Quit Now!", command=lambda: self.EarlyExit(start.tempName))
            self.earlyexit.grid(row=8, column=2, padx=5, pady=5)
            self.randomguess = Button(self.gameWindow, text="Use Random Guess!", command=lambda: self.UserRandoGuess())
            self.randomguess.grid(row=6, column=2, padx=5, pady=5)
            self.randomBet = Button(self.gameWindow, text="Random Bet!", command=lambda: self.UseRandoBet(start.tempName))
            self.randomBet.grid(row=1, column=2, padx=5, pady=5)
            self.gameWindow.mainloop()

    def UseRandoBet(self, user):
        self.randobet = random.randrange(1, user.player_bank)
        self.userBetTK.delete(0, END)
        self.userBetTK.insert(0, "{}".format(self.randobet))


    def UserRandoGuess(self):
        self.rando1 = random.randint(1, 5)
        self.rando2 = random.randint(1, 10)
        self.rando3 = random.randint(1, 15)
        self.userGuess1TK.delete(0, END)
        self.userGuess2TK.delete(0, END)
        self.userGuess3TK.delete(0, END)
        self.userGuess1TK.insert(0, "{}".format(self.rando1))
        self.userGuess2TK.insert(0, "{}".format(self.rando2))
        self.userGuess3TK.insert(0, "{}".format(self.rando3))

    def EarlyExit(self, user):
        self.ask = messagebox.askyesno("Quit?", "We will save your records first! Are you sure you want to quit?")
        if self.ask is True:
            user.AppendRecords()
            raise SystemExit
        else:
            pass

    def BuyMultiplyer(self):
        self.buymulti = Toplevel()
        self.buymulti.title("Buy A bigger multiplier!")
        self.buymulti.geometry("400x200")
        self.buy = Button(self.buymulti, text="Buy for $3500!", command=lambda: self.NewMulti(start.tempName))
        self.buyL = Label(self.buymulti, text="Buy a random multiplier between 1 and 30!")
        self.buy.grid(row=2, column=1, padx=5, pady=5)
        self.buyL.grid(row=1, column=1, padx=5, pady=5)
        self.buymulti.mainloop()

    def NewMulti(self, user):
        global gamemultiplyer
        self.window = Toplevel()
        self.window.withdraw()
        user.player_bank -= 3500
        gamemultiplyer = random.randint(1, 30)
        self.new = messagebox.showwarning(self.window, "The new multiplier is.. {}!".format(gamemultiplyer))
        self.buymulti.destroy()

    def BuyHint(self):
        self.HintWindow = Toplevel()
        self.HintWindow.title("Buy a hint!")
        self.HintWindow.geometry("500x200")
        self.hint1 = Button(self.HintWindow, text="Hint 1-5 // $500", command=lambda: self.Hint1(start.tempName))
        self.hint2 = Button(self.HintWindow, text="Hint 1-10 // $1000", command=lambda: self.Hint2(start.tempName))
        self.hint3 = Button(self.HintWindow, text="Hint 1-15 // $2000", command=lambda: self.Hint3(start.tempName))
        self.hint1.grid(row=1, column=1, padx=5, pady=5)
        self.hint2.grid(row=1, column=2, padx=5, pady=5)
        self.hint3.grid(row=1, column=3, padx=5, pady=5)
        self.HintWindow.mainloop()

    def Hint1(self, user):
        user.player_bank -= 500
        if winNum1 > 2:
            self.hint = "The number is greater than 2!"
        else:
            self.hint = "The number is less than 3!"
        self.hwindow = Tk()
        self.hwindow.withdraw()
        self.h1 = messagebox.showwarning("Hint!", "{}".format(self.hint))
        self.hwindow.destroy()

    def Hint2(self, user):
        user.player_bank -= 1000
        if winNum2 > 5:
            self.hint = "The number is greater than 5!"
        else:
            self.hint = "The number is less than 6!"
        self.hwindow = Tk()
        self.hwindow.withdraw()
        self.h1 = messagebox.showwarning("Hint!", "{}".format(self.hint))
        self.hwindow.destroy()

    def Hint3(self, user):
        user.player_bank -= 2000
        if winNum3 > 9:
            self.hint = "The number is greater than 9!"
        else:
            self.hint = "The number is less than 10!"
        self.hwindow = Tk()
        self.hwindow.withdraw()
        self.h1 = messagebox.showwarning("Hint!", "{}".format(self.hint))
        self.hwindow.destroy()

    def CheckScore(self, user):
        self.scorecheck = messagebox.showwarning("{} vs {}!".format(user.name, self.computer1.compname),"{} total bank ${} vs "
                                                                                                        "{} total bank ${}!"
                                                 .format(user.name, user.player_bank, self.computer1.compname, self.computer1.comp_bank))

    def GetGameInputs(self, user):
        self.GameComputer(self.computer1)
        self.userBet = int(self.userBetTK.get())
        self.userGuess1 = int(self.userGuess1TK.get())
        self.userGuess2 = int(self.userGuess2TK.get())
        self.userGuess3 = int(self.userGuess3TK.get())
        self.resultsWindow = Tk()
        self.resultsWindow.focus_force()
        self.resultsWindow.title("Round {} Results!".format(i))
        self.resultsWindow.geometry("600x600")
        self.gameWindow.destroy()
        self.info1 = Label(self.resultsWindow, fg="red", text="{}".format(user.name))
        self.info2 = Label(self.resultsWindow, fg="Blue", text="{}".format(self.computer1.compname))
        self.info3 = Label(self.resultsWindow, fg="red", text="Wager:")
        self.info4 = Label(self.resultsWindow, fg="Blue", text="Wager:")
        self.info5 = Label(self.resultsWindow, fg="red", text="${}".format(self.userBet))
        self.info6 = Label(self.resultsWindow, fg="Blue", text="${}".format(self.comp_bet))
        self.info7 = Label(self.resultsWindow, fg="Green", text="Winning Numbers!")
        self.info8 = Label(self.resultsWindow, fg="Green", text="{}".format(winNum1))
        self.info9 = Label(self.resultsWindow, fg="red", text="Guess 1:")
        self.info10 = Label(self.resultsWindow, fg="Blue", text="Guess 1:")
        self.info11 = Label(self.resultsWindow, fg="red", text="{}".format(self.userGuess1))
        self.info12 = Label(self.resultsWindow, fg="Blue", text="{}".format(self.comp_guess1))
        self.info13 = Label(self.resultsWindow, fg="Red", text="Guess 2:")
        self.info14 = Label(self.resultsWindow, fg="Blue", text="Guess 2:")
        self.info15 = Label(self.resultsWindow, fg="red", text="{}".format(self.userGuess2))
        self.info16 = Label(self.resultsWindow, fg="Blue", text="{}".format(self.comp_guess2))
        self.info17 = Label(self.resultsWindow, fg="Green", text="{}".format(winNum2))
        self.info18 = Label(self.resultsWindow, fg="Green", text="{}".format(winNum3))
        self.info19 = Label(self.resultsWindow, fg="red", text="Guess 3:")
        self.info20 = Label(self.resultsWindow, fg="Blue", text="Guess 3:")
        self.info21 = Label(self.resultsWindow, fg="red", text="{}".format(self.userGuess3))
        self.info22 = Label(self.resultsWindow, fg="Blue", text="{}".format(self.comp_guess3))
        self.infomulti = Label(self.resultsWindow, fg="Green", text="The game multiplyer is: {}".format(gamemultiplyer))
        self.infomulti.grid(row=1, column=2, padx=5, pady=5)
        self.info1.grid(row=1, column=1, padx=5, pady=5)
        self.info2.grid(row=1, column=3, padx=5, pady=5)
        self.info3.grid(row=2, column=1, padx=5, pady=5)
        self.info4.grid(row=2, column=3, padx=5, pady=5)
        self.info5.grid(row=3, column=1, padx=0, pady=5)
        self.info6.grid(row=3, column=3, padx=0, pady=5)
        self.info7.grid(row=4, column=2, padx=5, pady=5)
        self.info8.grid(row=6, column=2, padx=0, pady=5)
        self.info9.grid(row=5, column=1, padx=5, pady=5)
        self.info10.grid(row=5, column=3, padx=5, pady=5)
        self.info11.grid(row=6, column=1, padx=0, pady=5)
        self.info12.grid(row=6, column=3, padx=0, pady=5)
        self.info13.grid(row=7, column=1, padx=5, pady=5)
        self.info14.grid(row=7, column=3, padx=5, pady=5)
        self.info15.grid(row=8, column=1, padx=0, pady=5)
        self.info16.grid(row=8, column=3, padx=0, pady=5)
        self.info17.grid(row=8, column=2, padx=0, pady=5)
        self.info18.grid(row=10, column=2, padx=0, pady=5)
        self.info19.grid(row=9, column=1, padx=5, pady=5)
        self.info20.grid(row=9, column=3, padx=5, pady=5)
        self.info21.grid(row=10, column=1, padx=0, pady=5)
        self.info22.grid(row=10, column=3, padx=0, pady=5)
        if self.userGuess1 == winNum1:
            self.user_winnings1 = self.userBet * (i + 1 + gamemultiplyer)
            user.player_bank = user.player_bank + self.user_winnings1
            self.win = Label(self.resultsWindow, fg="red", text="Guess 1 Correct!")
            self.win1 = Label(self.resultsWindow, fg="green", text="You won: ${}".format(self.user_winnings1))
            self.win.grid(row=11, column=1, padx=5, pady=5)
            self.win1.grid(row=12, column=1, padx=5, pady=5)
        else:
            self.loss = Label(self.resultsWindow, text="Guess 1 Incorrect!")
            self.loss.grid(row=11, column=1, padx=5, pady=5)
        if self.userGuess2 == winNum2:
            self.user_winnings2 = self.userBet * (i + 2 + gamemultiplyer)
            user.player_bank = user.player_bank + self.user_winnings2
            self.win2 = Label(self.resultsWindow, fg="red", text="Guess 2 Correct!")
            self.win22 = Label(self.resultsWindow, fg="green", text="You won: ${}".format(self.user_winnings2))
            self.win2.grid(row=13, column=1, padx=5, pady=5)
            self.win22.grid(row=14, column=1, padx=5, pady=5)
        else:
            self.loss1 = Label(self.resultsWindow, text="Guess 2 Incorrect!")
            self.loss1.grid(row=13, column=1, padx=5, pady=5)
        if self.userGuess3 == winNum3:
            self.user_winnings3 = self.userBet * (i + 3 + gamemultiplyer)
            user.player_bank = user.player_bank + self.user_winnings3
            self.win3 = Label(self.resultsWindow, fg="red", text="Guess 3 Correct!")
            self.win33 = Label(self.resultsWindow, fg="green", text="You won: ${}".format(self.user_winnings3))
            self.win3.grid(row=15, column=1, padx=5, pady=5)
            self.win33.grid(row=16, column=1, padx=5, pady=5)
        else:
            self.loss2 = Label(self.resultsWindow, text="Guess 3 Incorrect!")
            self.loss2.grid(row=15, column=1, padx=5, pady=5)
        self.user_winnings = self.user_winnings1 + self.user_winnings2 + self.user_winnings3
        if self.userGuess1 != winNum1 and self.userGuess2 != winNum2 and self.userGuess3 != winNum3:
            user.player_bank = user.player_bank - self.userBet
            self.loss = Label(self.resultsWindow, text="None Correct! You lost: ${}".format(self.userBet))
            self.loss.grid(row=16, column=1, padx=5, pady=5)
        else:
            self.winresult = Label(self.resultsWindow, text="Your total winnings: ${}".format(self.user_winnings))
            self.winresult.grid(row=17, column=1, padx=5, pady=5)
        if self.comp_guess1 == winNum1:
            self.compwin1 = Label(self.resultsWindow, fg="Blue", text="Guess 1 Correct!")
            self.compwin11 = Label(self.resultsWindow, fg="Blue", text="{} won: ${}".format(self.computer1.compname,
                                                                                        self.comp_winnings1))
            self.compwin1.grid(row=11, column=3, padx=5, pady=5)
            self.compwin11.grid(row=12, column=3, padx=5, pady=5)
        else:
            self.comploss1 = Label(self.resultsWindow, text="Guess 1 Incorrect!")
            self.comploss1.grid(row=11, column=3, padx=5, pady=5)
        if self.comp_guess2 == winNum2:
            self.compwin2 = Label(self.resultsWindow, fg="Blue", text="Guess 2 Correct!")
            self.compwin22 = Label(self.resultsWindow, fg="Blue", text="{} won: ${}".format(self.computer1.compname,
                                                                                           self.comp_winnings2))
            self.compwin2.grid(row=13, column=3, padx=5, pady=5)
            self.compwin22.grid(row=14, column=3, padx=5, pady=5)
        else:
            self.comploss2 = Label(self.resultsWindow, text="Guess 2 Incorrect!")
            self.comploss2.grid(row=13, column=3, padx=5, pady=5)
        if self.comp_guess3 == winNum3:
            self.compwin3 = Label(self.resultsWindow, fg="Blue", text="Guess 3 Correct!")
            self.compwin33 = Label(self.resultsWindow, fg="Blue", text="{} won: ${}".format(self.computer1.compname,
                                                                                           self.comp_winnings3))
            self.compwin3.grid(row=15, column=3, padx=5, pady=5)
            self.compwin33.grid(row=16, column=3, padx=5, pady=5)
        else:
            self.comploss3 = Label(self.resultsWindow, text="Guess 3 Incorrect!")
            self.comploss3.grid(row=15, column=3, padx=5, pady=5)
        if self.comp_guess1 != winNum1 and self.comp_guess2 != winNum2 and self.comp_guess3 != winNum3:
            self.closs = Label(self.resultsWindow, text="None correct! {} lost: ${}".format(self.computer1.compname,
                                                                                           self.comp_bet))
            self.closs.grid(row=16, column=3, padx=5, pady=5)
        else:
            self.ctotal = Label(self.resultsWindow, text="{} total winnings: ${}".format(self.computer1.compname,
                                                                                         self.comp_total_winnings))
            self.ctotal.grid(row=16, column=3, padx=5, pady=5)
        if i < 6:
            self.newround = Button(self.resultsWindow, text="Start Round {}!".format(i+1), command=lambda: self.GoNextRd())
            self.newround.grid(row=18, column=2, padx=5, pady=5)
        elif i == 6:
            self.newround = Button(self.resultsWindow, text="Start Final Round!", command=lambda: self.GoNextRd())
            self.newround.grid(row=18, column=2, padx=5, pady=5)
        else:
            self.newround = Button(self.resultsWindow, text="And the winner is..", command=lambda: self.GetWinner(user))
            self.newround.grid(row=18, column=2, padx=5, pady=5)

    def GetWinner(self, user):
        self.blank = Tk()
        self.blank.withdraw()
        if user.player_bank > self.computer1.comp_bank:
            user.player_wins += 1
            self.closewindow = messagebox.showwarning("The Winner Is..", "{} with a total bank of ${}!".format(user.name,
                                                                                                           user.player_bank))
        else:
            user.player_losses += 1
            self.closewindow = messagebox.showwarning("The Winner is..", "{} with a total bank of ${}!".format(self.computer1.compname,
                                                                                                       self.computer1.comp_bank))
        user.AppendRecords()
        self.resultsWindow.destroy()
        start.OpenMainWindow()

    def GoNextRd(self):
        self.resultsWindow.destroy()


class MainPopUp:
    def __init__(self):
        self.tempComp = Game()

    def FirstWindow(self):
        self.window1 = Tk()
        self.window1.title("Welcome to our guessing game!")
        self.window1.geometry("400x100")
        self.text = Label(self.window1, text="What is your name? ")
        self.text.grid(row=1, column=1, padx=10, pady=10)
        self.user_input = Entry(self.window1)
        self.user_input.grid(row=1, column=2, padx=10, pady=10)
        self.submit = Button(self.window1, text="Start Game!", command=lambda: self.GetUserName())
        self.submit.grid(row=2, columnspan=4)
        self.window1.mainloop()

    def GetUserName(self):
        self.tempName = self.user_input.get()
        self.tempName = Player(self.tempName)
        self.window1.destroy()
        self.OpenMainWindow()
        self.getCompName = GetCompName()
        self.tempComp = Computer(self.getCompName)
        return self.tempName

    def OpenMainWindow(self):
        self.root = Tk()
        self.root.geometry("600x300")
        self.root.title("Guessing Game V2")
        self.topmenu = Menu(self.root)
        self.root.config(menu=self.topmenu)
        self.topmenu.add_command(label="New Game", command=lambda: self.NewGameOpt())
        self.topmenu.add_command(label="Records", command=lambda: self.DisplayRecord())
        self.topmenu.add_command(label="Reset Records", command=lambda: self.ResetRecord())
        self.topmenu.add_command(label="Quit", command=lambda: self.QuitGame())

        self.welcome_player = Label(self.root, text="{} Welcome to the game!".format(self.tempName.name))
        self.welcome_player.pack(padx=5)
        self.welcome_computer = Label(self.root, text="{} you are going to play our best computer player.. {}!".format
                                                                                                (self.tempName.name,
                                                                                               self.tempComp.computer1.compname))
        self.welcome_computer.pack(padx=5)
        self.play = Button(self.root, text="Play!", command=lambda: self.StartGame())
        self.play.pack()
        self.directions = Text(self.root)
        self.directions.insert(1.0, "\n"
                                    "\n"
                                    "The game is played in 7 rounds! Each round, you will place a wager.\n"
                                    "This wager can be whatever you like, but must not exceed your total bank.\n"
                                    "You will guess numbers, between 1-5, 1-10 and, 1-15.\n"
                                    "Each guess is worth more than the previous. Each round is worth more than the previous!\n"
                                    "There is also a random game multiplier. In the final round, the multiplier is worth 5!\n"
                                    "At the end of the last round the player with the biggest bank wins.\n"
                                    "We will keep your lifetime records. You can check them by clicking 'Records'.\n"
                                    "If you wish to reset the records, just click Reset Records!\n"
                                    "Best of luck {}!".format(self.tempName.name),END)
        self.directions.pack()

        self.root.mainloop()

    def StartGame(self):
        self.root.destroy()
        self.game = Game().GameUser(self.tempName)

    def DisplayRecord(self):
        self.tempName.GetRecords()
        self.recordspopup = Toplevel()
        self.recordspopup.focus_set()
        self.recordspopup.geometry("350x200")
        self.displayrecords = Text(self.recordspopup)
        self.displayrecords.insert(1.0, "{} Here are your liftime records!\n"
                               "Total Money in the bank: ${}\n"
                               "Total wins: {}\n"
                               "Total losses: {}\n"
                               "Lifetime guesses: {}".format(self.tempName.name, self.tempName.player_record_bank,
                                                             self.tempName.player_record_wins,
                                                             self.tempName.player_record_losses,
                                                            self.tempName.player_record_guesses), END)
        self.displayrecords.pack()

    def ResetRecord(self):
        self.confirmreset = messagebox.askyesno("Confirm?",
                                                "This will reset all your lifetime records for player {}!\n"
                                                            "This action is not reversible!\n"
                                                            "Do you still wish to reset records?".format(self.tempName.name))
        if self.confirmreset is True:
            self.tempName.ResetRecords()
            self.truereset = messagebox.showinfo("Records Reset!", "Your records have been reset!")
        else:
            self.truereset = messagebox.showinfo("Reset Cancled", "The reset has been canceled!")

    def NewGameOpt(self):
        self.asknew = messagebox.askokcancel("Start New Game?", "Are you sure you want to start a new game?\n"
                                                             "We will attempt to save any new stats before you do!")
        if self.asknew is True:
            self.tempName.AppendRecords()
            self.root.destroy()
            self.FirstWindow()
        else:
            pass

    def QuitGame(self):
        self.tempName.AppendRecords()
        raise SystemExit

start = MainPopUp()
start.FirstWindow()