How can i get a TkInter Label to toggle on off? the toggle on works the label isnt visable upon start and then appears when the checkbutton is pressed (=1), however when the button is pressed again (=0)the label remains.
I have tried
def STIC_Sel():
STIC_Sel_State = var1.get()
if (STIC_Sel_State == 1):
print("Test STIC Selected")
IPT_Display_STIC = Label(IPT, text=Output_IP_Address_STIC, anchor=W)
IPT_Display_STIC_Window = canvas_IPT.create_window(150, 160, anchor = 'sw', window = IPT_Display_STIC)
else:
print("STIC Not Selected")var1 = IntVar()
IPT_Test_STIC = Checkbutton(IPT, text = "STIC", justify=LEFT,width=15, indicatoron=0,
variable = var1, command=STIC_Sel)
IPT_Test_STIC_Window = canvas_IPT.create_window(20, 165, anchor = 'sw', window = IPT_Test_STIC)I have tried
def STIC_Sel():
STIC_Sel_State = var1.get()
if (STIC_Sel_State == 1):
print("Test STIC Selected")
IPT_Display_STIC = Label(IPT, text=Output_IP_Address_STIC, anchor=W)
IPT_Display_STIC_Window = canvas_IPT.create_window(150, 160, anchor = 'sw', window = IPT_Display_STIC)
else:
print("STIC Not Selected")
IPT_Display_STIC = Label(IPT, text="Not Selected For Test", anchor=W)
IPT_Display_STIC_Window = canvas_IPT.create_window(150, 160, anchor = 'sw', window = IPT_Display_STIC) But this just generates a label on top of the previous one
