Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In your project file, make a function called draw _ fun _ shape with parameters x , y , and win in that order. This

In your project file, make a function called draw_fun_shape with parameters x,y, and win in that order. This is exactly like the eyes function from Lab 1, but the function is named differently. In this new function, make a fun shape using multiple primitive shapes and different colors. The important part of this function is that if a different x and y are sent to the function, the shape should draw in that new location. The function example from lab did this, so study how that works before starting your own function. The requirements are:
Use at least three different primitives from
graphics.py.
Use at least three different colors in your project.
The function must not query for the mouse position in its code - it should use the x and y that is passed to it when the function is called. You should also avoid drawing a shape at a specific spot, like 200,100, as the shape will not follow the mouse position and only be at that specific location.
The drawn shape should be nicely done and interesting. A face with two eyes is not acceptable (since that is just what the lab did). You should show some creativity here.
Then, write a function (see the instructions from Lab). In that main function open a window, set a background color, and then loop forever. In the calorie counter code in lecture, we made an example of a loop that repeated forever.
Make sure that all the code to start up the window is in the function and not just random statements in the file. Your code may work, but each part of the code should have a purpose and not be spread around. The autograder system depends on your code having good style by having everything in a function.
This open a window and loop approach is like the code from Lab1, but put into a (main) function. Inside the loop,
clear the window
use the
graphics.py function (this is one I added, so it is not in the documentation). The function determines where the mouse cursor is in the window and returns a Point object (see the
graphics.py documentation) that corresponds to the location of the cursor. The function does not wait for a click to get the position. Look in the documentation for an example of using the related getMouse function and follow that example to use getMousePosition.
get the x and y from the returned from getMousePosition (refer to Sec3.1 of the documentation).
call your function with the current x and y of the mouse cursor.
finally, update the screen.
A running program can be stopped from PyCharm or by clicking on the red x close window icon on the window.
At the bottom of the screen, add the code to make the main function be called when the script is run
if _=="_":
Finally, go through your code and make sure it is well-formatted and any variables you have created have meaningful names.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions

Question

Answer the multiple choice question

Answered: 1 week ago