我正在用tkinter开发一个应用程序。我想在一个窗口中显示两个帧,一个在窗口的右侧,另一个在左侧
with open("C:/gui_assistant/res/settings/frame_amount.txt", "r") as f:
check_amount = f.read()
if "one" in check_amount:
one_frame = tk.Frame(main, bg="#1a1919", relief=SUNKEN)
one_frame.place(relx=0.85, rely=0, relwidth=0.5, relheight=1)
elif "two" in check_amount:
first_frame = tk.Frame(main, bg="#1a1919", relief=SUNKEN)
first_frame.place(relx=0.85, rely=0, relwidth=0.5, relheight=1)
second_frame = tk.Frame(main, bg="#1a1919", relief=SUNKEN)
second_frame.place(relx=0, rely=0, relwidth=0.5, relheight=1)
如您所知,它首先打开文本文件,然后检查给定的数量,因此如果文本文件显示“一”,则只应创建一个帧,或者如果显示“两”,则应创建两个帧。现在,文本文件显示“两个”,但在运行应用程序后只创建一个帧。Tkinter是否只允许窗口中有一帧?或者
试试这个
相关问题 更多 >
编程相关推荐