Python 3.x 我需要使用txt文档中的坐标在画布上绘制形状

Python 3.x 我需要使用txt文档中的坐标在画布上绘制形状,python-3.x,canvas,Python 3.x,Canvas,我有一个包含以下内容的文本文件 50 50 50 100 100 50 50 50 -1 -1 100 100 150 150 150 100 -1 -1 代码 我已经将它们拆分并转换为整数,我似乎无法完成最后一步,让它在画布上绘制形状 from simplegraphics import * def draw_shapes(): file_name = input("What file do you want to read: ") file = open(file_na

我有一个包含以下内容的文本文件

50 50
50 100
100 50
50 50
-1 -1
100 100
150 150
150 100
-1 -1
代码

我已经将它们拆分并转换为整数,我似乎无法完成最后一步,让它在画布上绘制形状

from simplegraphics import *

def draw_shapes():
    file_name = input("What file do you want to read: ")
    file = open(file_name, 'r') #opening the file in read mode
    open_canvas(400, 400)
    lowest = -1
    highest = " "

    for line in file:
        line = line.rstrip()
        x, y = line.split(" ")
        x = int(x) #converting the variable into ints
        y = int(y)
        draw_line(10,10,10,10)

    file.close() #closing the file    
    close_canvas_after_click()

draw_shapes()