我能够在 Python 中使用 Zelle graphics.py 成功绘制多边形,但我无法显示所用点的坐标。如何仅使用 getPoints() 完成它。
这是我的代码:
import math
import graphics #must be included
from graphics import* # must be included
def main():
win = graphics.GraphWin("Exercise 2, Polygon", 500, 500)
#denotes window size
win.setBackground("black")
polygon = Polygon(Point(60,80),Point(50,70),Point(70,20),Point(90,50),Point(100,80))
#Include "Point" in the statement, else it wouldn't work
polygon.setOutline("yellow")
polygon.setWidth(5)
polygon.draw(win)
main()