Open Lutheine opened 10 months ago
Use TEST.set(None) and update the load function as follow. def load(): if TEST.get() != 'None': test = CTkEntry(root, textvariable=TEST) test.pack() Hopefully this will resolve your issue
Hi Ahad, that doesn't solve the problem just because None is being treated like string 'None' and causes the variable to be 4 length while I need it to be 0, when variable is not in use. It's no different than assigning variable to any string, I currently workaround with ' ' instead of '' and then later use check if len(var.strip()) == 0.
Have a look:
TEST = StringVar()
TEST.set(None)
print(len(TEST.get())) #result is 4, while should be 0 for my needs
print(type(Test.get())) #results in class type of str
print(type(None)) #it's class type of NoneType
Hi Tom, I'm experiencing alike issue right now, but the difference is that widget throwing exception error is CTkEntry. I'm doing dynamic UI and when trying to destroy widget, I want to empty out any text in textvariable stringVar stored, so I can reuse the same variable if widget is created again. After destroying a widget, textvariable can't be .set('') without error, while .set('%anything%') doesn't throw exceptions.
Code:
Error:
Originally posted by @Lutheine in https://github.com/TomSchimansky/CustomTkinter/issues/468#issuecomment-1713529172