python Method of Obtaining Click Coordinates and Drawing Graphics
- 2021-07-13 05:35:05
- OfStack
Gets the input 5 stipple 5 sides
def pentagonUpdate():
p = {}
win = GraphWin("Click", 800, 300)# The last two values are the length and width of the form
for i in range(5):
p[i] = win.getMouse()
p[i].draw(win)
polygon = Polygon(p[0], p[1], p[2], p[3], p[4])
polygon.setFill("peachpuff")
polygon.setOutline("black")
polygon.draw(win)
win.getMouse()
Gets two inputted stippling lines
def GetMouseDraw():
p = {}
win = GraphWin("Click me")
for i in range(2):
p[i] = win.getMouse()
p[i].draw(win)
line = Line(p[0], p[1])
line.draw(win)
win.getMouse()
if __name__ == '__main__':
pentagonUpdate()