I have a beginner question about python tkinter:
I've got a Frame like this:
import tkinter
root = tkinter.Tk()
root.geometry('100x100')
frame = tkinter.Frame(root, width=100, height=80, bg='green')
frame.pack()
root.mainloop()
The result is a window, thats mostly green. Now i want to place a Label on that green area. Thus I add the following between frame.pack() and root.mainloop():
label = tkinter.Label(frame, text='TESTTEST')
label.pack()
This results in a window printing TESTTEST. But nothing is green anymore. Where did my Frame go? The text isn't close to being big enough to completely cover the green area with it's own background.
What am I doing wrong? Why doesn't it work like that?
Putting another Frame between frame and label like this:
frame2 = tkinter.Frame(frame, width=100, height=20)
frame2.pack()
results in an area above the Label being colourless. However, to the left and right of my Label it's green?! Neither above nor below is any green. Just left and right of my Label.
How does this work?