python - Tkinter Toplevel width and height not working -
i have following code, when method run toplevel window displays correct title , contents, remains it's tiny default size. doing stupidly , wrong here?
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 wish controlled 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()
tk() , toplevel() geometry can set self.top.geometry("%dx%d%+d%+d" % (300, 200, 250, 125))
. first 2 numbers represent dimensions of window. third , fourth number say, window appear.
Comments
Post a Comment