How to set a tkinter window to a constant size

后端 未结 5 781
粉色の甜心
粉色の甜心 2020-12-13 05:01

I\'m programming a little game with tkinter and briefly, I\'m stuck.

I have a kind od starting menu, in which are two buttons and one label.

If I just create

5条回答
  •  一个人的身影
    2020-12-13 05:54

    If you want a window as a whole to have a specific size, you can just give it the size you want with the geometry command. That's really all you need to do.

    For example:

    mw.geometry("500x500")
    

    Though, you'll also want to make sure that the widgets inside the window resize properly, so change how you add the frame to this:

    back.pack(fill="both", expand=True)
    

提交回复
热议问题