#πŸ”’ Can I make a tkinter window not be able to be resized?

9 messages Β· Page 1 of 1 (latest)

hazy niche
#

I am learning tkinter and was wondering if there was a way to make my window non-resizeable. Google's AI and StackOverflow both lead to py root.resizeable(False, False) I've tried this (yes my tkinter window is named root aswell, so it's not a naming issue), and I keep getting the error " Unresolved attribute reference 'resizeable' for class 'Tk' ". Any Ideas what might be up? My code (with a resizeable window) is:

import tkinter as tk

root = tk.Tk()
root.geometry("415x420")
root.title("Tkinter Window")
icon = tk.PhotoImage(file='pythonlogo.png')
root.config(background='dark gray')
root.iconphoto(True, icon)
root.resizeable(False, False)

title = tk.Label(root, text='Title', font=('Times New Roman', 35, 'bold'))
title.pack()

quitButton = tk.Button(root, text='Close', font=('Times New Roman', 12), compound='bottom', command=quit)
quitButton.pack()

root.mainloop()```
weary fieldBOT
#

@hazy niche

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hazy niche
#

Ok

eager saffron
#

after a little bit of poking around, root.wm_resizable(False, False) seems to work for me

hazy niche
#

thank you, will try that now

#

that works! thank you so much!

#

!close

weary fieldBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.