2013-05-19 3 views
1

메소드가 실행될 때 다음 코드가 있습니다. 최상위 창에 올바른 제목과 내용이 표시되지만 작은 기본 크기로 남아 있습니다. 어리석은 짓하고 분명히 여기 뭔가 잘못하고있는 건가요?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() 

답변

6

의 Tk()과 최상위 레벨()은 형상이 self.top.geometry("%dx%d%+d%+d" % (300, 200, 250, 125)) 의해 설정 될 수있다. 처음 두 숫자는 창의 크기를 나타냅니다. 세 번째와 네 번째 숫자는 윈도우가 나타날 곳을 말합니다.

+0

나는이 작동하는지 확인했다. 여기에 설명되어 있습니다 : http://effbot.org/tkinterbook/wm.htm#Tkinter.Wm.geometry-method – twasbrillig

0

사용이 :

self.secondWin.wm_geometry("1000x1000") 
관련 문제