I'm trying to make a very simple tkinter app, but I can't seem to figure out why one of my widgets isn't appearing. The below code should render the string '30' in a row above the button-label pairs, but it only shows the button-label pairs and no additional string.
from tkinter import *
from tkinter import ttk
data = {
'projects': {
'project': {
'name': 'Project',
'starttime': 0
},
'another': {
'name': 'Another',
'starttime': 0
}
},
'clock': {
'clockedin?': False,
'time': 30
}
}
def makebutton():
row = 1
for item in data['projects']:
ttk.Button(frm, text=data['projects'][item]['name']).grid(column=0,row=row)
ttk.Label(frm, text=data['projects'][item]['starttime']).grid(column=1, row=row)
row = row + 1
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text=data['clock']['time']).grid(column=0, row=2) # should say '30'
makebutton()
root.mainloop()
If I move the '30' label line below makebutton(), it displays '30', but over the bottom button.
What am I misunderstanding here?