我有以下代码,当运行该方法时,Toplevel 窗口显示正确的标题和内容,但仍然是很小的默认大小。我在这里做一些愚蠢且明显错误的事情吗?
def new_game(self):
self.top = tk.Toplevel(width=300, height=200)
self.top.title("New Game Settings")
title_msg = tk.Message(self.top, text="Which players do you wish to be controlled by the AI?")
msg_ai_1 = tk.Message(self.top, text="Player 1")
msg_ai_2 = tk.Message(self.top, text="Player 2")
title_msg.pack()
msg_ai_1.pack()
msg_ai_2.pack()
self.confirm_button = tk.Button(self.top, text="Okay", command=self.top.destroy)
self.confirm_button.pack()