Set the Background Color¶
Games have colors, including a background color. Arcade makes it really easy to set the background color, so let’s do so.
import arcade if __name__ == '__main__': arcade.open_window(600, 600, 'Coin Game') arcade.set_background_color(arcade.color.WHEAT) arcade.run()
- We changed the title of our window
- We added a call to
- Names such as
WHEATare called constants. In Python, constants are noted with all caps.
- Arcade’s names for colors are really just RGB tuples
- Running this does not yet change the background color
Ctrl-Bto navigate to the definition of
WHEATand tell its RGB value.
- What is a tuple?
- Can you change a value in a tuple?
- How can you tell that a variable is intended to be used as a constant?
- In Python, can you change the value of a constant?
- Why doesn’t the background color change?