【问题标题】:How do I change the thickness of a shape's outline on a tkinter canvas in Python?如何在 Python 中更改 tkinter 画布上形状轮廓的粗细?
【发布时间】:2019-06-06 16:50:21
【问题描述】:

有没有办法增加或减少 tkinter 画布上形状轮廓的厚度?如果是这样,我该怎么做?

这里有一些代码可以用作示例。如何更改矩形的轮廓宽度?

from tkinter import *

root = Tk()
canvas = Canvas(root, width=500, height=350)
canvas.pack()

canvas.create_rectangle(50, 50, 150, 150, fill='blue')

root.mainloop()

感谢您的帮助!

【问题讨论】:

    标签: python macos tkinter tkinter-canvas


    【解决方案1】:

    使用选项宽度

    =^..^=

    from tkinter import *
    
    root = Tk()
    canvas = Canvas(root, width=500, height=350)
    canvas.pack()
    canvas.create_rectangle(50, 50, 150, 150, width=0, fill='blue')
    root.mainloop()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-29
      • 1970-01-01
      • 2014-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-13
      相关资源
      最近更新 更多