toggle widgets

preview_player
Показать описание
This video covers how to make widgets visible or invisible; i.e. how to toggle them.

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

Man, your channel is pure gold! Please never stop to posting videos, they're so helpful 🙏🏻

JuniorMurvin-xv
Автор

thank you so much for this tutorial series on tkinter

leox
Автор

there are many ways
1: removal label.pack and button.pack and rearrange them inside the function
2: button.pack(side='bottom')
3: {especially for the label} label.congifure(text='') inside the function

mouazalbitar
Автор

Question, at 13:00 when having to force the button to stay down.
Why not assign button.pack(side = "bottom")?


def toggle_label_pack():
global label_visible

if label_visible:
label.pack_forget()
label_visible = False
else:
label_visible = True
label.pack(expand = True)


#widgets
label_visible = True
label = ttk.Label(window, text = "A label")
label.pack(expand = True)

button = ttk.Button(window, text = "toggle label", command = toggle_label_pack )
button.pack(side = "bottom")

luispereira
Автор

Is it incorrect to solve the exercise this way: "button.pack(side = "bottom")"?

janlochman
join shbcf.ru