【问题标题】:Python Tkinter Button Border Not Following DimensionsPython Tkinter 按钮边框不跟随尺寸
【发布时间】:2020-07-31 16:31:39
【问题描述】:

在 PyCharm 中,我正在尝试制作一个 Tkinter 应用程序。我正在创建按钮来放置和更改它们的尺寸。当我更改每个按钮的尺寸时,我可以单击该按钮并在我指定的尺寸内使用它,但边框不会勾勒出/跟随尺寸。

我将不胜感激。

button1 = tkinter.Button(root, text="Button1", height=20, width=20, borderwidth=10)
button1.grid(column=0, row=0)


button2 = tkinter.Button(root, text="Button2")
button2.config(height=20, width=20)
button2.grid(column=1, row=0)

button3 = tkinter.Button(root, text="Button3")
button3.config(height=20, width=20)
button3.grid(column=2, row=0)

【问题讨论】:

    标签: python user-interface tkinter pycharm


    【解决方案1】:

    第一个按钮显示显示边框,在接下来的两个按钮中,您没有提到任何边框宽度。我做了以下,它看起来不错。

    button2 = Button(root, text = 'Button2', borderwidth = 10)
    button2.config(height = 20, width = 20)
    button2.grid(column = 1, row = 0)
    
    button3 = Button(root, text = 'Button3', borderwidth = 10)
    button3.config(height = 20, width = 20)
    button3.grid(column = 2, row = 0)
    

    【讨论】:

      猜你喜欢
      • 2023-02-06
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      • 1970-01-01
      • 1970-01-01
      • 2019-07-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多