Chapter 28
Graphical User Interfaces
Most software written today uses a graphical user interface (GUI) rather
than the text-based interface we have used in most of our examples. In this
chapter, we rewrite the Chuck-a-Luck program from Chapter 24 to use a
graphical interface.
Listing 28.1: Chuck-a-Luck (GUI Version)
1 # chuckgui.py
2
3 from dicegui import DiceGUI
4 from tkinter import
*
5
6 class ChuckALuckGUI(Frame):
7 def __init__(self, parent):
8 Frame.__init__(self, parent)
9 parent.geometry("500x300")
10 parent.title("Chuck-A-Luck")
11 self.dice = DiceGUI(3, self)
12 self.dice.pack(fill="y", expand=True)
13 self.score = 0
14 self.makecontrols()
15 self.makescore() ...
Get A Concise Introduction to Programming in Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.