How do I set a minimum window size in tkinter?

后端 未结 4 1054
情歌与酒
情歌与酒 2020-12-09 03:05

My understanding is that after initializing all frames and widgets in the __init__ method, the tkinter window resizes to fit all these components.

I wou

4条回答
  •  伪装坚强ぢ
    2020-12-09 03:37

    root = Tk()
    

    Since the root window is created. The root window is a main application window in our programs. It has a title bar and borders. These are provided by the window manager. It must be created before any other widgets.

    root.geometry("250x150+300+300")
    

    The geometry() method sets a size for the window and positions it on the screen. The first two parameters are width and height of the window. The last two parameters are x, y screen coordinates.

    app = Example(root)
    

    Here we create the instance of the application class.

    root.mainloop()  
    

    Finally, we enter the mainloop. The event handling starts from this point. The mainloop receives events from the window system and dispatches them to the application widgets. It is terminated when we click on the close button of the titlebar or call the quit() method.

    enter image description here

    I hope you found this useful.

提交回复
热议问题