【发布时间】:2021-01-24 15:48:27
【问题描述】:
嘿,我正在尝试使用 tkinter 制作 gui,以下是我使用的代码。问题是没有错误,程序执行,我会看到根目录,但没有框架。在添加之前按钮我能够看到框架,但添加按钮后框架消失,我只能看到按钮请帮助
from tkinter import*
from tkinter import ttk
root=Tk()
root.title("STUDY")
style=ttk.Style()
style.configure("custom.TFrame",background="black")
frame=ttk.Frame(root,style="custom.TFrame")
frame.pack()
frame.config(height=100,width=100)
ttk.Button(frame,text="CLICK ME").pack()
root.mainloop()
【问题讨论】:
-
在
root.title("STUDY")之后添加root.geometry("100x100")
标签: python user-interface button tkinter frame