make widget span window width tkinter 1

make widget span window width tkinter

import tkinter
import tkinter.ttk

win = tkinter.Tk()

frame = tkinter.Frame(win, bg='red', height=300)
frame.grid(row=0, column=0, sticky='ew')


Here is what the above code is Doing:
1. Create a window
2. Create a frame
3. Add the frame to the window
4. Configure the window to expand the frame to fill the window
5. Start the main loop

The result is a window with a red frame that fills the window.

Similar Posts