Python 无法在Zelle graphics.py中绘制多边形后显示坐标

Python 无法在Zelle graphics.py中绘制多边形后显示坐标,python,python-3.x,zelle-graphics,Python,Python 3.x,Zelle Graphics,我能够在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) #den

我能够在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()

您只需在main方法中使用
print(polygon.getPoints())
即可,该方法将
[点(60.0,80.0)、点(50.0,70.0)、点(70.0,20.0)、点(90.0,50.0)、点(100.0,80.0)]
作为输出

示例代码:
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)

    print(polygon.getPoints())    

main()