Hello, guys!
I've written a GUI for a program. It's written like shit, the goal was to get it done fast. Well it didn't exactly work out, so when I refresh the data, every label disappears. Here is the code:
class GUI:
def __init__(self, master):
self.master = master
self.label = Label(master, width=50, height=15)
self.label.pack()
self.makeMenus()
self.showStats()
Then, loads of labels, some with textvariables like this:
def showStats(self):
stats = loadStats()
# buys
Label(
self.label,
text='Buys',
font=BOLDFONT
).place(x=40, y=10, anchor=NW)
Label(self.label, text='Times:').place(x=10, y=50, anchor=NW)
self.buyTimes = StringVar(self.label)
Label(
self.label,
textvariable=self.buyTimes
).place(x=60, y=50, anchor=NW)
...
... and here is the code for the refresh method:
def refreshStats(self):
stats = loadStats()
self.buyTimes.set(stats['buys'])
...
So the problem is, that after refreshing, every label disappears for a second, but when I move the cursor over the ones with textvariables, they reapper, but the others don't.
What should I do?