def _set_up_gui(self): """Sets up the Tkinter user interface.""" # Disable pylint warning for instance attributes defined outside # __init__(), since this method is called by __init__() # # pylint: disable=W0201 self.root = Tk() self.root.title('Video Poker') # Set up menubar self.menubar = Menu(self.root) self.gamemenu = Menu(self.menubar, tearoff=0) self.gamemenu.add_command(label="Quit", command=sys.exit) self.menubar.add_cascade(label="Game", menu=self.gamemenu) self.helpmenu = Menu(self.menubar, tearoff=0) self.helpmenu.add_command(label="About", command=self.help_about) self.menubar.add_cascade(label="Help", menu=self.helpmenu) self.root.config(menu=self.menubar) # Set up card images self.backimg = PhotoImage(file="{0}b.gif".format(self.gifdir)) for num in range(5): lbl = Label(self.root, image=self.backimg) lbl.grid(row=0, column=num, padx=10, pady=10) lbl.bind("<Button-1>", self.flip) lbl.flipped = True lbl.pos = str(num + 1) self.cardimg.append(lbl) # Set up labels, fields and buttons self.pot_lbl = Label(self.root, text="Pot:") self.pot_lbl.grid(row=1, column=0, padx=10, pady=2, sticky=W) self.pot_amt_lbl = Label(self.root, text="") self.pot_amt_lbl.grid(row=1, column=1, columnspan=2, padx=10, pady=2, sticky=W) self._update_pot() self.bet_lbl = Label(self.root, text="Bet ($):") self.bet_lbl.grid(row=2, column=0, padx=10, pady=2, sticky=W) self.bet_str = StringVar() self.bet_str.set(str(self.defaultbet)) self.bet_amt_fld = Entry(self.root, textvariable=self.bet_str) self.bet_amt_fld.grid(row=2, column=1, columnspan=2, padx=10, pady=2, sticky=W) self.button = Button(self.root, text="Deal", command=self.button_clicked) self.button.grid(row=1, column=3, rowspan=2, columnspan=2, sticky=W + E + S + N, padx=10) self.status_lbl = Label(self.root, bd=1, relief=SUNKEN, text="Welcome to the casino! " + "Click 'Deal' to play!") self.status_lbl.grid(row=3, column=0, columnspan=5, padx=10, pady=10, ipadx=10, ipady=10, sticky=W + E + S + N) # Show winnings table lbl = Label(self.root, text="Winnings Table", relief=RAISED) lbl.grid(row=4, column=1, columnspan=3, pady=15, ipadx=10, ipady=10, sticky=W + E) # Two different tables, one for easy mode, one for normal # mode, so be prepared to show either one. wte = {2500: "Royal Flush", 250: "Straight Flush", 100: "Four of a Kind", 50: "Full House", 20: "Flush", 15: "Straight", 4: "Three of a Kind", 3: "Two Pair", 2: "Jacks or Higher"} wtn = {800: "Royal Flush", 50: "Straight Flush", 25: "Four of a Kind", 9: "Full House", 6: "Flush", 4: "Straight", 3: "Three of a Kind", 2: "Two Pair", 1: "Jacks or Higher"} wtxt = wte if self.game_easy else wtn row = 5 for key in sorted(wtxt.keys(), reverse=True): lbl = Label(self.root, text=wtxt[key]) lbl.grid(row=row, column=1, columnspan=2, sticky=W) lbl = Label(self.root, text="{0} : 1".format(key)) lbl.grid(row=row, column=3, sticky=E) row += 1 lbl = Label(self.root, text="") lbl.grid(row=row, column=0, columnspan=5, pady=15)