Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your program should do the following: 1. Use the same background image as for Homework 2 - Align Draw. Remember, the .png image of the
Your program should do the following: 1. Use the same background image as for Homework 2 - Align Draw. Remember, the .png image of the application window is 970x635 pixels 2. Draw a circle with a RADIUS of 80 starting at (0,0). Use green for your pen color. 3. Register for mouse clicks 4. When you click anywhere in the circle with your mouse, erase the circle 5. When you click anywhere on the canvas, draw the circle, with the center at the (x, y) coordinates where you clicked Note: You may use the Turtle/pen as a global variable. However, other than any constants you use, no variables should be declared in the global namespace. We have provided the PositionService component for your convenience. Import it into your program and then you can use it as a "position ledger" that allows you to store and retrieve information about your circle regarding its position and visibility. PositionService is implemented using object-oriented programming, so you probably won't understand the code yet. Don't worry about that, simply use the service via these functions: set_position_x( x ) # set the x position of your circle set_position_y( y ) # set the y position of your circle set_position(x, y) # set both x and y positions of your circle get_position_x() # get the x position get_position_yo # get the y position is_visible() # returns True/False if you've "hidden" your shape by erasing it. #YOU are responsible for setting the visibility with set_visible set_visible( visibility ) # Pass in a Boolean to indicate that you've hidden or displayed your shape #YOU are responsible for setting the visibility with set_visible set_visible( visibility ) # Pass in a Boolean to indicate that you've hidden or displayed your shape # By convention, True is visible, False is hidden Notes: . Remember our inscribed circle from last week. For our "click capture", you are allowed to use the surrounding square as your "area for the circle". In other words, if I click in the upper right corner of the square below, that would be an allowable "click capture for the circle in this program despite the fact that it is properly outside of the circle's region. For this assignment, it's close enough. A It's very difficult to test graphics-related functions without explicit test tools (screen-grabbers, functional test tools, etc.), so your most important job is to ensure your turtle movement and drawing is as consistent as possible. Of note, when you move the turtle, it has a directional heading (N/S/E/W). Take care to set the heading consistently to ensure repeatable drawing of the circle Your program should do the following: 1. Use the same background image as for Homework 2 - Align Draw. Remember, the .png image of the application window is 970x635 pixels 2. Draw a circle with a RADIUS of 80 starting at (0,0). Use green for your pen color. 3. Register for mouse clicks 4. When you click anywhere in the circle with your mouse, erase the circle 5. When you click anywhere on the canvas, draw the circle, with the center at the (x, y) coordinates where you clicked Note: You may use the Turtle/pen as a global variable. However, other than any constants you use, no variables should be declared in the global namespace. We have provided the PositionService component for your convenience. Import it into your program and then you can use it as a "position ledger" that allows you to store and retrieve information about your circle regarding its position and visibility. PositionService is implemented using object-oriented programming, so you probably won't understand the code yet. Don't worry about that, simply use the service via these functions: set_position_x( x ) # set the x position of your circle set_position_y( y ) # set the y position of your circle set_position(x, y) # set both x and y positions of your circle get_position_x() # get the x position get_position_yo # get the y position is_visible() # returns True/False if you've "hidden" your shape by erasing it. #YOU are responsible for setting the visibility with set_visible set_visible( visibility ) # Pass in a Boolean to indicate that you've hidden or displayed your shape #YOU are responsible for setting the visibility with set_visible set_visible( visibility ) # Pass in a Boolean to indicate that you've hidden or displayed your shape # By convention, True is visible, False is hidden Notes: . Remember our inscribed circle from last week. For our "click capture", you are allowed to use the surrounding square as your "area for the circle". In other words, if I click in the upper right corner of the square below, that would be an allowable "click capture for the circle in this program despite the fact that it is properly outside of the circle's region. For this assignment, it's close enough. A It's very difficult to test graphics-related functions without explicit test tools (screen-grabbers, functional test tools, etc.), so your most important job is to ensure your turtle movement and drawing is as consistent as possible. Of note, when you move the turtle, it has a directional heading (N/S/E/W). Take care to set the heading consistently to ensure repeatable drawing of the circle
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started