我在 python 的 tkinter 中写了一小段代码,看看我是否可以让一个框架出现在我的窗口中。这是下面的代码:
from tkinter import *
root = Tk()
root.title("Window")
root.state("zoomed")
root.config(bg="white")
winHeight = int(root.winfo_height())
winWidth = int(root.winfo_width())
controlFrame = Frame(root, bg="red")
controlFrame.pack()
root.mainloop()
我创建了一个背景颜色为白色的全尺寸窗口。它里面的框架应该是红色的。但是,当我运行这段代码时,我没有看到任何红色。我确定我把它和所有东西都打包了。
万千封印
白衣染霜花
相关分类