Chapter 10: Problem 8
Modify the DieView class from the chapter by adding a method that allows the color of the pips to be specified. setColor(self, color) Changes the color of the pips to color. Hints: You can change the color by changing the value of the instance variable foreground, but you also need to redraw the die after doing this. Modify setValue so that it remembers the value of the die in an instance variable. Then setColor can call setValue and pass the stored value to redraw the die. You can test your new class with the roller.py program. Have the dice change to a random color after each roll (you can generate a random color with the color_rgb function).
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.