【问题标题】:Make a button that adapts its size to the text it contains in tkinter制作一个按钮,使其大小适应它在 tkinter 中包含的文本
【发布时间】:2020-04-21 02:15:10
【问题描述】:

我需要以下代码中的按钮来调整大小,以便正确地适应文本。这怎么可能?当前是文本 all_definitions_list[0] 比按钮宽,然后文本会被弹出。

choice1=Button(newWindow, text=all_definitions_list[0], height=5, width=50, 
command=lambda:wut(choice1, choice2, choice3, choice4, wordLabel))
choice1.place(relx=0.5, rely=y_list[0], anchor=N)

【问题讨论】:

  • “调整大小以正确适应文本”:不要使用参数width=50

标签: python user-interface button tkinter size


【解决方案1】:

不要使用参数 width=50

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-29
    • 2020-12-21
    • 2016-11-24
    相关资源
    最近更新 更多