Organizing elements in a frame w/ tkinter

22 hours ago 3
ARTICLE AD BOX

I am a novice Programmer learning GUI and Tkinter for the first time, attempting to make a productivity app for myself. I am trying not to use AI as much as possible.

I have created a Frame within the root window, and in it I am attempting to place a Label, and two Buttons.

The problem that I am trying to solve is that it appears the Label is on top of both of the Buttons, and if I make the label take up more than 1 line or row, then the buttons below no longer fit.

GUI

I have attempted to add this code:

self.bottom_info_label.grid(row=0, column=0) self.move_button.grid(row=0, column=1, sticky="e") self.new_project_button.grid(row=1, column=1, sticky="e")

But it appears to overwrite the pack method above where I've anchored to buttons to the right. So I've removed the .grid code for now

Here is my code for this Frame:

# Bottom Frame self.bottom_frame = tk.Frame( self.root, borderwidth=l, relief="solid", padx=8, pady=4, height=80 ) self.bottom_frame.pack(side="bottom", fill="x") self.bottom_frame.pack_propagate(False) # Set Bottom Frame details/information self.bottom_info_label = tk.Label( self.bottom_frame, textvariable=self.bottom_label_text, font=("Aria1", 9, "italic") self.bottom_info_label.pack(anchor="w") # Bindings self.active_list_box.bind("<<ListboxSe1ect>>", self.on_select_event) self.hold_list_box.bind("<<ListboxSe1ect>>", self.on_select_event) # Test: self.root.bind("<ButtonPress-1>", self.deselect_item) # Move Project Button self.move_button = tk.Button( self.bottom_frame, text="Move to Projects on Hold", state="disabled", command=self.move_selected ) self.move_button.pack(anchor="e", pady=(0, 0)) # New Project Button self.new_project_button = tk.Button( self.bottom_frame, text="New Project...", command=self.open_new_project_dialog ) self.new_project_button.pack(anchor="e", pady=(0, 0))
Read Entire Article