actually, you can pack in function : def create_segment(parent, label_text: str, btn_text: str): frame = Frame(master=parent) # Grid Layout frame.rowconfigure(0, weight=1) frame.columnconfigure((0,1,2), weight=1, uniform="a") label = Label(frame, text=label_text, anchor="center").grid(row=0, column=0, sticky="nsew") button = Button(frame, text=btn_text).grid(row=0, column=1, sticky="nsew") frame.pack(side="top", expand=True, fill="both", padx=10, pady=10) return frame and return it in a variable for future actions (pack_forget() etc..) segment_08 = create_segment(window, label_text="label 08", btn_text="button 08") PS : Thank you so much for these great quality courses, (Pygame
kinda: If the project is very simple then functions are fine but once it gets even a bit more complex you want classes. Might even be a good idea to go with classes by default
That is because widgets in that segment use pack() geometry manager, which automatically, by default, places widgets from top to bottom. So the window is divided into a grid of one row and three columns by a grid() geometry manager, while in each cell of the third column, he is creating kind of two rows, but since he is using the pack() method, we can't talk about 2nd row. They are just two rows under each other. If he would add side attribute to ttk.Entry and ttk.Button with the value "left" wouldn't look like two rows but just one.
Excellent videos. I’ve seen a few of yours now and they are really helpful. So clear and well explained. Thanks.
love your tutorials! thank you very much!
The more i praise you, the less it is.
You are really awesome sir.❤
Check out
Expense tracker Customtkinter project (modern GUI)
ua-cam.com/video/1p_Y_QB3c1A/v-deo.htmlsi=V0XgF8VZvO5CUxsD
That very detailed tutorial master, thank you for your generosity.
actually, you can pack in function :
def create_segment(parent, label_text: str, btn_text: str):
frame = Frame(master=parent)
# Grid Layout
frame.rowconfigure(0, weight=1)
frame.columnconfigure((0,1,2), weight=1, uniform="a")
label = Label(frame, text=label_text, anchor="center").grid(row=0, column=0, sticky="nsew")
button = Button(frame, text=btn_text).grid(row=0, column=1, sticky="nsew")
frame.pack(side="top", expand=True, fill="both", padx=10, pady=10)
return frame
and return it in a variable for future actions (pack_forget() etc..)
segment_08 = create_segment(window, label_text="label 08", btn_text="button 08")
PS : Thank you so much for these great quality courses, (Pygame
good video
So you decide on OOP or functional regarding the amount of code needed right?
kinda: If the project is very simple then functions are fine but once it gets even a bit more complex you want classes. Might even be a good idea to go with classes by default
Hi, thanks for the video
If I do this with checkboxes, and I click one, every checkbox is marked - why is that?
Segment class has row 0. How they appear like under each other row 1, row 2...
I think all labels are placed in row 0, column 0 and all the buttons are placed in row 0, column 1
That is because widgets in that segment use pack() geometry manager, which automatically, by default, places widgets from top to bottom. So the window is divided into a grid of one row and three columns by a grid() geometry manager, while in each cell of the third column, he is creating kind of two rows, but since he is using the pack() method, we can't talk about 2nd row. They are just two rows under each other. If he would add side attribute to ttk.Entry and ttk.Button with the value "left" wouldn't look like two rows but just one.
I cannot class-based code, what could the problem be?
You cannot what?
👏👏👏
I am failing to run this Class based app, what could be the problem?
If you don’t give any more details nobody can help you. You should always give the error code
Please fix the audio.
The audio sounds good, what problem do you have?