Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+2 votes
asked in CSC201 Spring 2021 by (701 points)

3 Answers

+3 votes

If you look at the file names for each background, you'll notice they have numbers in them. If you make the image with an f-string for the file name and take in the inputted number as a variable, then you can put the number variable into the file name, which will help you get the right image.

answered by (5.5k points)
+2 votes

The basic code to create an Image object is:

Image(anchorPoint, filename)

Therefore, each bgNum will store a different filename. You can create an if statement, which depends on the user's input to change the filename of the image object.

answered by (2.8k points)
+1 vote

There is a file of choosing background color game, you could refer it to make users choose your backgrounds.

answered by (4.1k points)