This assignment is Homework 24, and its deadline has been extended until classtime on Monday, May 1.

Assignment

  1. Write a program that animates a ball bouncing around a Tkinter canvas. When the ball reaches the edge of the canvas, it should bounce in a different direction to stay within the canvas. Bind at least two key-press events that change properties of the ball, such as its color or size.

  2. Write a program that draws a smiley face on a Tkinter canvas at the location where the user clicks the mouse. The program should allow the user to click the mouse many times to draw many smiley faces.

  3. Write a program to simulate an archery game. Your program should use a Tkinter canvas to draw a target like the one below. Your program should allow the user to click the target to simulate shooting arrows.

    When the user clicks the target, the program should draw a dot at that location and compute the score. Scores for each ring are as follows: yellow 9, red 7, blue 5, black 3, and white 1. Use Tkinter labels to display the scores for each arrow, along with the total score. Also provide a Quit button that closes the window.

    Your program should look something like this:

    archery game

Submitting your work

After you have finished your solutions, paste all of your solutions into a single Python file. Use comments to clearly state the problem numbers corresponding to your code. Save your file and upload it to the HW24 assignment on Moodle.