Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1.  
  2. import graphics
  3. from graphics import *
  4. def m1():
  5. v = 800
  6. win = GraphWin("window",v,v)
  7. b = eval(input("velocity: "))
  8. c = eval(input("height: "))
  9. x = 0
  10.  
  11. for i in range(1000000):
  12.  
  13. x = x + 1
  14. y = ( -16 * ( (x/100) ** 2 ) ) + (b * (x/100)) + c
  15. dot = Line(Point(x, v-y), Point(x,v))
  16. bot = Point(x, v-y)
  17. bot.setFill("red")
  18. if x%100 == 0:
  19. dot.setFill("red")
  20. else:
  21. dot.setFill("black")
  22. dot.draw(win)
  23. bot.draw(win)
  24.  
  25. def m2():
  26. v = 800
  27. win = GraphWin("win",v,v)
  28. win.setCoords(0.0,0.0,3.0,4.0)
  29. Text(Point(1,3), " what is the velocity: ").draw(win)
  30. Text(Point(1,1), " what is the initial height: ").draw(win)
  31. b = Entry(Point(2,3),5)
  32. b.draw(win)
  33. c = Entry(Point(2,1),5)
  34. c.draw(win)
  35. button = Text(Point(1.5,2.0), "Convert It")
  36. button.draw(win)
  37. Rectangle(Point(1,1.5),Point(2,2.5).draw(win))
  38. win.getMouse()
  39. x = Rectangle(Point(0,0),Point(v,v))
  40. x.setFill("white")
  41. try:
  42. b = eval(b.getText())
  43. c = eval(c.getText())
  44. except:
  45. print("please enter the values THEN press go :)")
  46. win.close()
  47. m1()
  48.  
  49. x = 0
  50. for i in range(1000000):
  51. x = x + 1
  52. y = round(( -16 * ( (x/100) ** 2 ) ) + (b * (x/100)) + c)
  53. dot = Line(Point(x, v-y), Point(x,v))
  54. bot = Point(x, v-y)
  55. bot.setFill("red")
  56. if x%100 == 0:
  57. dot.setFill("red")
  58. else:
  59. dot.setFill("black")
  60. dot.draw(win)
  61. bot.draw(win)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement