【发布时间】:2020-04-09 16:47:28
【问题描述】:
我正在使用 tkinter,我正在尝试制作一个未出现的 Label 小部件。我创建标签的行执行,但是窗口上没有显示任何内容。
from tkinter import * class const():
def __init__(self,par):
self.parent = par
self.window = Toplevel()
self.window.title("ZZ")
self.window.geometry("200x250")
self.window.protocol("WM_DELETE_WINDOW", self.parent.quit)
self.bnl = []
self.count = 0
self.dic = {1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: '', 8: '', 9: ''}
self.lbl=Label(par, text="Begin",font=("Arial",64),fg="BLACK",bg="RED")
self.lbl.grid(row=4,column=0,columnspan=3)
【问题讨论】:
-
你运行 mainloop() 吗?
-
是的,其他小部件按预期工作。
标签: python python-3.x tkinter