I have three labels that are directly under eachother (see image). I'd like the labels to be collapsed when they're empty.
In the case of the image, the second label is empty. I'd like the third label to be placed on the location of the second label.
In WPF (.NET) this would be done via:
<Style TargetType="TextBlock">
<Style.Triggers>
<Trigger Property="Text" Value="">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
</Style.Triggers>
</Style>
The simplified code of the picture below is as such:
import customtkinter as ctk
gui = ctk.CTk()
status = ctk.StringVar(value="status_test")
warning = ctk.StringVar(value="")
error = ctk.StringVar(value="error_test")
ctk.CTkLabel(gui, textvariable=status, text_color="grey", wraplength=gui.winfo_vrootwidth()).pack()
ctk.CTkLabel(gui, textvariable=warning, text_color="yellow", wraplength=gui.winfo_vrootwidth()).pack()
ctk.CTkLabel(gui, textvariable=error, text_color="red", wraplength=gui.winfo_vrootwidth()).pack()
gui.mainloop()