【发布时间】:2019-02-02 00:14:35
【问题描述】:
我有 Python 3.6.3。我正在尝试使用提交和退出按钮编写一个简单的 GUI 应用程序。我有这个 GUI 代码:
from tkinter import *
from sys import exit
...
some = True
stuff = False
here = "bar"
top = Tk()
submitButton = Button(top, text="Submit", command=lambda: submit(some, things, set, here)).pack(pady=50, side=LEFT)
exitButton = Button(top, text="Quit", command=exit).pack(pady=50, side=RIGHT)
top.mainloop()
但是,在运行此代码后,我的按钮标签是不可见的:
为了再次看到它们,我需要调整窗口大小,哪怕只是一点点:
我在这里做错了什么,或者这是 tkinter 的错误?
【问题讨论】:
-
它是否使用默认填充 (0) 执行此操作?
-
无法重现,gui 显示正确(OSX)
-
顺便说一句,
.pack返回None,因此您实际上并未将 Button 小部件绑定到这些名称。 -
在 ubuntu 上为我工作
-
@TheoC 你是怎么解决的?
标签: python python-3.x button tkinter