Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# This function CALLS Eyeball TWICE (once for each eye) to place the pair of eyeballs on the screen. Stare must first determine the correct

# This function CALLS Eyeball TWICE (once for each eye) to place the pair of eyeballs on the screen. Stare must first determine the correct radius and center positions for each eye before calling Eyeball at all. # def Stare (Canvas,NewColor):

return

In the Stare function (see above), write new code to call Eyeball twice, once for the left eye and once for the right eye, with the correct radius and coordinates for each eye computed from the size of the Canvas. If the width and height of the Canvas are extracted into variables W and H as follows: W = getWidth (Canvas) H = getHeight (Canvas)

Then all the other measurements needed to find the position of the eyeballs are computed as follows: Xleft = 1/4W Xright = 3/4W Y = 1/2H

What remains for Stare to compute is the eyeball radius. The radius R is computed from the minimum (using Pythons min(,) function) of Xleft and Y, times , minus 5 pixels. This may seem overly complicated, but doing it this way guarantees that the eyes will always fit onto the screen.

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions