메소드가 실행될 때 다음 코드가 있습니다. 최상위 창에 올바른 제목과 내용이 표시되지만 작은 기본 크기로 남아 있습니다. 어리석은 짓하고 분명히 여기 뭔가 잘못하고있는 건가요?Tkinter 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()
나는이 작동하는지 확인했다. 여기에 설명되어 있습니다 : http://effbot.org/tkinterbook/wm.htm#Tkinter.Wm.geometry-method – twasbrillig