該程式運行良好,但是當我洗掉代碼的注釋部分時,畫布上的行無法正確顯示
from tkinter import *
import numpy as np
import turtle
widthx = 400
heighty = 300
ws = Tk()
ws.title('Light Sim')
ws.geometry('400x300')
ws.config(bg='white')
x = 100
y = -100
c = Canvas(bg="white", height=heighty, width=widthx,)
c.grid(row=3, column=0, stick='sw')
#screen = turtle.TurtleScreen(c)
c.create_line(y, 0, x,0, fill='blue', width=2)
c.create_line(0,y,0,x,fill='grey', width=2)
ws.mainloop()
uj5u.com熱心網友回復:
Canvas 和 TurtleScreen 中的坐標原點不同——左上角和視窗中心。因此,線條消失 - 超出螢屏。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/465738.html
上一篇:填充行時更改Excel檔案中的行
