I want to make a window can be decreased to a certain size (for example 200x200) using Tkinter, but I only found that either can be resizable (using resizable() method) or not. For example
from tkinter import *
v = tk()
v.geometry('500x500')
v.mainloop()
So I want that this window can be decreased until 200x200, not less.
From what I gather from your answer, you are trying to set a minimum window size in tkinter. Here is some code that does just that:
from tkinter import *
from tkinter.ttk import *
from time import strftime
root = Tk()
# setting the minimum size of the root window
root.minsize(150, 100)
# Adding widgets to the root window
Label(root, text = 'Sample Window',font = ('Verdana', 15)).pack(side = TOP, pady = 10)
Button(root, text = 'Click Me!').pack(side = TOP)
mainloop()
Hope that helps! I am new to stackoverflow.
To make that you need to do something like this-
from tkinter import *
v = tk()
v.geometry('500x500')
v.mainloop()
OR
from tkinter import*
w= tk()
w.minsize('123') #for minimum size
w.maxsize('123') #for maximum size
w.mainloop()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.