尽管语法正确,Tkinter LabelFrame 没有出现在屏幕上

问题描述

我正在使用 VSC。我正在创建一个国际象棋计时器项目,为此我需要将两个玩家的按钮放在 LabelFrame 内,这样我就不必乱用网格选项,因为它使生活变得非常困难。我会将按钮放在 LabelFrame 内,LabelFrame 将打包在主根页面上,然后在 LabelFrame 内进行正确的填充以集中按钮。

示例:(我之前的 Tkinter 项目截图):

What I want it to look like

这里的按钮使用 Grid 选项在 LabelFrame 内居中,而 LabelFrame 本身在屏幕上是 .packed()。

这是我当前的代码

ma​​in.py

from tkinter import * 
from TkUtil import Centre #My own custom module that centers the window on the screen of the user
root=Tk()
root.title("Chess Timer")
root.config(bg="white")
Centre(root,600,400) #USed my own self made module,no Error in this line :)
root.iconbitmap("D:\Coding\DevenIcon.ico")
lab=Label(root,text="Deven's Chess Timer",font="Helvetica 24",bg="white").pack(pady=10)
R_title=LabelFrame(root,text="Welcome To Game Hub!",font=("Helvetica",20,"bold"),padx=5,pady=5,width="30",bg="white")
R_title.pack(padx=10)
#labf=LabelFrame(root,text="BUTTONS",pady=5).pack()
root.mainloop()

输出截图:

Why is LabelFrame widget not coming on screen?

如何在屏幕上放置 LabelFrame 小部件?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)