Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tkinter按钮文本在窗口调整大小之前不可见_Python_Python 3.x_Button_Tkinter - Fatal编程技术网

Python Tkinter按钮文本在窗口调整大小之前不可见

Python Tkinter按钮文本在窗口调整大小之前不可见,python,python-3.x,button,tkinter,Python,Python 3.x,Button,Tkinter,我有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)).pac

我有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的错误吗?

在主循环调用之前添加一个更新调用

top.update()
top.mainloop()

也考虑升级到Python 3.7,因为MAC中的许多TKIMTER问题在3.7中被固定。p> 它是用默认填充(0)实现的吗?无法复制,gui显示正确(OSX)顺便说一句,

.pack
返回
None
,因此您实际上没有将按钮小部件绑定到这些名称。在ubuntu@TheoC您是如何修复的?这没有帮助,我在它之前添加了
top.update()
,但没有任何更改。