Relative Content

Tag Archive for tkinter

How are tkinter’s fill, side, expand options in pack interacting with each other?

import tkinter as tk window = tk.Tk() frame1 = tk.Frame(master=None, width=200, height=100, bg=”red”) frame1.pack(fill=tk.BOTH, side=tk.TOP, expand=False) frame2 = tk.Frame(master=None, width=100, height=50, bg=”yellow”) frame2.pack(fill=tk.BOTH, side=tk.TOP, expand=False) frame3 = tk.Frame(master=None, width=50, height=25, bg=”blue”) frame3.pack(fill=tk.BOTH, side=tk.TOP, expand=False) window.mainloop() fill and side interactions Problem is I expect tk.BOTH to fill vertically when I drag window down, but it does […]

Tkinter place geometry manager not overlapping

Over the past several years I’ve been using a full-featured combobox widget that I made by stitching together other Tkinter widgets. (Because I like it better than ttk.Combobox.) For the dropdown I’ve always used a Toplevel widget since it overlaps other widgets instead of pushing them aside. I’ve never been able to get the place geometry manager to work as the dropdown, it won’t overlap the other widgets. I know that some people say never use place() for anything anyway, but I just have to satisfy my curiosity as to whether it would be easier to use a placed Frame instead of using a borderless Toplevel window.