Creating custom components in tkinter with classes and functions

preview_player
Показать описание
This video covers how to create custom components either with classes or by creating widgets in functions / methods and returning them. Both are essential to create organised layouts.

You can get the code here:
Рекомендации по теме
Комментарии
Автор

Excellent videos. I’ve seen a few of yours now and they are really helpful. So clear and well explained. Thanks.

johnr.
Автор

That very detailed tutorial master, thank you for your generosity.

dryandave
Автор

The more i praise you, the less it is.
You are really awesome sir.❤

sonu-jangir
Автор

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 <3 and Tkinter).

nemoclyde
Автор

If I do this with checkboxes, and I click one, every checkbox is marked - why is that?

mrpeace
Автор

So you decide on OOP or functional regarding the amount of code needed right?

janlochman
Автор

Segment class has row 0. How they appear like under each other row 1, row 2...

eldarmammadov
Автор

I cannot class-based code, what could the problem be?

magachipula
Автор

I am failing to run this Class based app, what could be the problem?

magachipula