我有一个文本文件,其中包含以下内容
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()
我已将它们拆分并转换为整数,我似乎无法告诉它将形状绘制到画布上的最后一步