I've a small program with a feature to change the background color of a different window than the frame I use to ask for the background color. (I hope you understand this.) The program is written in Python with the Tkinter library.
Every time I click Enable in the window it changes the color of the background in the second window but not to the color I choose.
Where is the problem?
def Options():
def OptionButton():c= wert.get()if c == 1:fenster.config(background="red")elif c == 2:fenster.config(background="blue")else:fenster.config(background="yellow")global usermodusermod= tkinter.Entry.get(opEntry)fenster.update()option.destroy()def close():option.destroy()option=tkinter.Tk()
option.title("Options")
option.config(background="white")#Backgroundframe
bgFrame= tkinter.Frame(option)
bgFrame.grid(row=0, column=0, padx=10, pady=20)info3=tkinter.Label(bgFrame,text="Hintergrund im Menü")
info3.grid(row=1,column=0,padx=10, pady=20)#2 Radiobuttonglobal wert
wert = tkinter.StringVar()knopfA=tkinter.Radiobutton(bgFrame,text="Red", variable=wert,value="1")
knopfB=tkinter.Radiobutton(bgFrame,text="Blue", variable=wert, value="2")
knopfC=tkinter.Radiobutton(bgFrame,text="green", variable=wert,value="3")knopfA.grid(column=0,row=2)
knopfB.grid(column=0,row=3)
knopfC.grid(column=0,row=4)knopfA.select()#OptionFrame
opFrame = tkinter.Frame(option)
opFrame.grid(row=0, column=1,padx=10,pady=20)#Optionbutton
oplabel=tkinter.Label(opFrame,text="Value User Mode")
oplabel.grid(row=1,column=0,padx=10,pady=2)opEntry=tkinter.Entry(opFrame,width=12)
opEntry.grid(row=2,column=0,padx=10,pady=2)#OptionButtonFrame
btFrame=tkinter.Frame(option)
btFrame.grid(row=3,column=0,padx=10,pady=20)opbutton=tkinter.Button(btFrame,text="Enable", command = lambda:OptionButton())
opbutton.grid(row=1, column=0,padx=10,pady=2)clbutton=tkinter.Button(btFrame,text="close",command=lambda:close())
clbutton.grid(row=2, column=0,padx=10,pady=2)option.mainloop()