Andreas Sandberg Andreas Sandberg - 1 year ago 79
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

and not only
. 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)

Answer Source

Maybe you want this?

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

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download