If w is a correctly created main application window, which method would you use to foe both of the main window's dimensions?
1. w.resizable()
Theresizable()method takes two Boolean arguments,widthandheight, that specify whether the main window can be resized in the corresponding directions. PassingFalseto both arguments makes the main window non-resizable, whereas passingTrueto both arguments (or omitting them) makes the window resizable.
Here is an example that sets the dimensions of the main window to 500x400 pixels and makes it non-resizable:
import tkinter as tk
root = tk.Tk()
root.geometry('500x400')
root.resizable(False, False)
root.mainloop()
Tkinter documentation:https://docs.python.org/3/library/tk.html
Tkinter tutorial:https://www.python-course.eu/python_tkinter.php
1: https://stackoverflow.com/questions/36575890/how-to-set-a-tkinter-window-to-a-constant-size
Other methods that can be used to control the window size are:
w.pack_propagate () and w.grid_propagate (): These methods allow you to enable or disable the propagation of the size of the widgets inside the window to the window itself. By default, these methods are set to True, which means that the window will adjust its size according to the widgets it contains. You can set these methods to False or 0 to prevent this behavior, such as w.pack_propagate (0) or w.grid_propagate (0).
w.place (): This method allows you to place the window at a specific position and size relative to its parent window or screen. You can use keyword arguments such as x, y, width, height, relx, rely, relwidth, and relheight to specify the coordinates and dimensions of the window in absolute or relative terms, such as w.place (x=0, y=0, relwidth=1, relheight=1).
Roselle
3 days agoDoyle
7 days agoBuddy
14 days agoReta
3 days ago