when I use this code to change the color of the window and the label, everything goes great '
import tkinter
from tkinter.colorchooser import askcolor
photo = tkinter.PhotoImage(file="something.png")
label = tkinter.Label(
window,
text="this is a label",
image=photo,
compound='bottom'
)
label.pack(ipadx=0, ipady=0)
def change_color():
colors = askcolor(title="Tkinter Color Chooser")
window.configure(bg=colors[1])
label.configure(bg=colors[1])
ttk = tkinter.Button(
window,
text='Select a Color',
command=change_color).pack(expand=True)
but if I add the .pack()
to the first label declaration, and I try to change the color it returns error
label = tkinter.Label(
window,
text="this is a label",
image=photo,
compound='bottom'
).pack(ipadx=0, ipady=0)