Andreas Sandberg Andreas Sandberg - 3 months ago 15
Python Question

Tkinter labels change window size even after resizable

I want to know if there is a way to make labels NOT change the window size. I've tried master.resizable(width=False, height=False) but it doesn't work. Same with adding buttons, the window size still changes. Also, I want it to work with

.grid
and not only
.pack
. Here's an example:

import tkinter as tk
from tkinter import *
master = tk.Tk()

lel = tk.Button()
lel["text"] = "ooo"
lel.pack(side = "top")
master.configure(width=500, height=500)
master.resizable(width=False, height=False)
mainloop()

Answer

Maybe you want this?

master.geometry('{}x{}'.format(500, 500))

enter image description here

Comments