#This program utilizes the graphical interface manipulation #EECS 12 Homework 3 #By Ian Pareja #January 24, 2017 from math import * from graphics import * def main(): ######## Part_1: Creating graphic window, drawing two red points in window. ######### # First portion: This portion creates a graphic window win = GraphWin("Drawing a Cyclone",600,450) win.setCoords(0,0,600,450) msg = "Please enter the number of cycles, and click the start and end positions in the window." Text(Point(300, 438), msg).draw(win) Text(Point(65,415),"# of cycles:").draw(win) inbox =Entry(Point(130,415),5) inbox.draw(win) # Second portion: get 2 red points with mouse. Please Fill in this portion! (you need to use "start" and "stop" as variable names for start(center) point and stop point of cyclone) ############## Part_2: Drawing cyclon (with incremental line) with information from part_1 and calculated math in this part. Please Fill in this part! ############## # First portion: This portion gets the number of cycles from user and calculates Length, step_radius and angle. cycles=eval(inbox.getText()) radius = 0 # radius is zero for center point length = sqrt((stop.x-start.x)**2+(stop.y-start.y)**2) step_radius = length / (120*cycles) radian = atan((stop.y-start.y)/(stop.x-start.x)) initial_angle = int(degrees(radian)) # Second portion: Draw the cyclone with for loop based on description in slides. Please Fill in this portion! # Third portion: This portion close the window with pressing mouse on graphic window. win.getMouse() win.close() main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question