Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Help. Wrote a .py and so far it is right, but I need help with the last part. When a value is entered and

Python Help.

Wrote a .py and so far it is right, but I need help with the last part.

When a value is entered and the mouse is clicked, there should be instructions to click the mouse on the graph paper that number of times. The user should then be able to click the graph paper the specified number of times. Each time a large red point should appear, labeled with the count number, so the first point is labeled 1, the second is labeled 2. When the last point is clicked, the next mouse click should close the window.

image text in transcribed

MY CODE:

-----------------------------------------------------------------------------------

from graphics import *

# Crear window. win=GraphWin("graph paper",800,600) win.setCoords(-10,-6,6,6)

# Draw x-axis grid. for x in range(-6, 7, 1): xline=Line(Point(x,-6), Point(x,6)) xline.draw(win) xline.setFill("green") xtext=Text(Point(-.25,x),x).draw(win) # Draw y-axis grid. for y in range(-6, 7, 1): yline=Line(Point(-6,y), Point(6,y)) yline.draw(win) yline.setFill("green") ytext=Text(Point(y,-.25),y).draw(win) # Draw x-axis line. x0line=Line(Point(-6,0), Point(6,0)) x0line.setWidth(3) x0line.setFill("black") x0line.draw(win) # Draw y-axis line. y0line=Line(Point(0,-6), Point(0,6)) y0line.setWidth(3) y0line.setFill("black") y0line.draw(win)

-------------------------------------------------------------------------------------------

Indentation:

image text in transcribed

- I just need help with the following: Each time a large red point should appear, labeled with the count number, so the first point is labeled 1, the second is labeled 2. When the last point is clicked, the next mouse click should close the window.

Thank you!

graph paper Number of points click 7 times on graph paper. do from graphics import * # Crear window. win=GraphWin("graph paper",800,600), win.setCoords(-10,-6,6,6), # Draw x-axis grid. for x in range(-6, 7, 1): xline=Line(Point(x,-6), Point(x,6)), xline.draw(win) xline. setFill("green") xtext=Text(Point(-.25,x),x).draw(win) # Draw y-axis grid. for y in range(-6, 7, 1): yline=Line(Point(-6,y), Point(6,y)) yline.draw(win) yline. setFill("green") ytext=Text(Point(y,-.25),y).draw(win) # Draw x-axis line. xoline=Line(Point(-6,0), Point(6,0)); xoline. setWidth(3), xoline. setFill("black"), xoline.draw(win) # Draw y-axis line. yoline=Line (Point(0,-6), Point(0,6)), yoline.setWidth(3), yoline. setFill("black"), yoline.draw(win), graph paper Number of points click 7 times on graph paper. do from graphics import * # Crear window. win=GraphWin("graph paper",800,600), win.setCoords(-10,-6,6,6), # Draw x-axis grid. for x in range(-6, 7, 1): xline=Line(Point(x,-6), Point(x,6)), xline.draw(win) xline. setFill("green") xtext=Text(Point(-.25,x),x).draw(win) # Draw y-axis grid. for y in range(-6, 7, 1): yline=Line(Point(-6,y), Point(6,y)) yline.draw(win) yline. setFill("green") ytext=Text(Point(y,-.25),y).draw(win) # Draw x-axis line. xoline=Line(Point(-6,0), Point(6,0)); xoline. setWidth(3), xoline. setFill("black"), xoline.draw(win) # Draw y-axis line. yoline=Line (Point(0,-6), Point(0,6)), yoline.setWidth(3), yoline. setFill("black"), yoline.draw(win)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions