【问题标题】:Adding line color in tkinter在 tkinter 中添加线条颜色
【发布时间】:2021-10-24 01:40:48
【问题描述】:

我对使用 tkinter 添加线条颜色有疑问

 from tkinter import *

 screen = Tk()
 screen.title("John Arthur - login system")
 screen.geometry("500x300")
 screen.resizable(False,False)

 frame1 = Frame(screen,bg="green",height=100,width=500).pack(side="bottom")
 frame2 = Frame(screen,bg="white",height=100,width=500).pack(after=frame1,side="bottom")
 frame3 = Frame(screen,bg="orange",height=100,width=500).pack(after=frame2,side="bottom")

 Circle = Canvas(screen,width = 100,height = 500,bg=None,lc="blue")
 Circle.place(x = 10,y = 70)
 Circle.create_oval(60,60,210,210)

 screen.mainloop()

在这里我可以创建一个圆圈,但我需要将圆圈轮廓着色为蓝色 谁能帮忙?

【问题讨论】:

  • 顺便说一句,frame1frame2frame3 都是 None,而不是实际帧。查看this了解更多信息
  • 这在画布文档中有描述。
  • Canvas(...) 中设置bg=None 不能使画布透明。最好在画布内完成所有绘图,即 3 个色带。

标签: python-3.x user-interface tkinter


【解决方案1】:

您可以在创建圆圈时指定outline 颜色。

Circle.create_oval(60,60,210,210, outline='blue')

【讨论】:

    猜你喜欢
    • 2017-07-15
    • 1970-01-01
    • 2017-08-10
    • 1970-01-01
    • 2019-09-09
    • 1970-01-01
    • 2021-11-28
    • 2015-06-22
    • 1970-01-01
    相关资源
    最近更新 更多