小编tam*_*ini的帖子

如何在tkinter中绘制对角线箭头?

我需要从指向黄色框的蓝色和绿色框绘制两个箭头。我尝试使用 create_line 绘制对角线,但没有用。任何人都可以建议我可以绘制这些箭头的任何方法。使用 create_line 时的错误消息是:AttributeError: '_tkinter.tkapp' object has no attribute 'create_line'

from tkinter import *
import tkinter as tk


window = Tk()
window.geometry("900x500")
window.configure(background='red')
window.title("Theoretical")

label1 = Label(window, text="Hess' cycle of combustion", fg="black", bg="red", font=("Comic Sans MS", 20))
label1.pack()    

text1 = Text(window, width=20, height = 1, bg= "blue")
text1.place(x=200, y=100)

window.create_line(0, 0, 200, 100)
window.create_line(0, 100, 200, 0, fill="white")

text2 = Text(window, width=20, height = 1, bg= "green")
text2.place(x=520, y=100)

text3 = Text(window, width=20, height = 1, bg= "yellow")
text3.place(x=370, …
Run Code Online (Sandbox Code Playgroud)

python tkinter tkinter-canvas

-2
推荐指数
1
解决办法
7094
查看次数

标签 统计

python ×1

tkinter ×1

tkinter-canvas ×1