Background color nicht in allen bereichen

Fragen zu Tkinter.
Antworten
Budzi93
User
Beiträge: 6
Registriert: Dienstag 23. April 2019, 14:38

Ich habe ei Problem: Nämlich möchte ich das ganze Interface als Background Color weiß gestalten. Wo ich dann
"root.configure(background="white")" in den Code integriert habe, hab ich bemerkt das in dem Teil, wo ich bereits Buttons und Labels gesetzt habe (Oberer Bereich) noch immer als Hintergrundfarbe Grau hat.

Code: Alles auswählen

from tkinter import *

def raise_frame(frame):
    frame.tkraise()


root = Tk()
root.geometry("1920x1080")
root.title("Interface")
root.configure(background="white")

Interface = Frame(root)
Mitarbeiter = Frame(root)
Statistiken = Frame(root)
Preisliste = Frame(root)
Einstellungen = Frame(root)
Hilfe = Frame(root)

for frame in (Interface, Mitarbeiter, Statistiken, Preisliste, Einstellungen, Hilfe):
    frame.grid(row=0, column=0, sticky="news")


x = Label(Interface, text="Interface", anchor="center", font="Arial 20 bold", bg="white")
x.pack()
w1 = Button(Interface, text="Mitarbeiter", font="Arial 9 bold", bg="grey", fg="white", width=15, height=2, command=lambda:raise_frame(Mitarbeiter))
w1.pack(padx=50, pady=20, side=LEFT)
w2 = Button(Interface, text="Statistiken", font="Arial 9 bold", bg="grey", fg="white", width=15, height=2, command=lambda:raise_frame(Statistiken))
w2.pack(padx=135, pady=20, side=LEFT)
w3 = Button(Interface, text="Preisliste", font="Arial 9 bold", bg="grey", fg="white", width=15, height=2, command= lambda:raise_frame(Preisliste))
w3.pack(padx=135, pady=20, side=LEFT)
w4 = Button(Interface, text="Einstellungen", font="Arial 9 bold", bg="grey", fg="white", width=15, height=2, command= lambda:raise_frame(Einstellungen))
w4.pack(padx=135, pady=20, side=LEFT)
w5 = Button(Interface, text="Hilfe", font="Arial 9 bold", bg="grey", fg="white", width=15, height=2, command=lambda:raise_frame(Hilfe))
w5.pack(padx=50, pady=20, side=LEFT)

Label(Einstellungen, text="Einstelungen").pack()
Button(Einstellungen, text="Interface", command= lambda:raise_frame(Interface)).pack()

Label(Statistiken, text="Statistiken").pack()
Button(Statistiken, text="Interfce", command= lambda:raise_frame(Interface)).pack()


raise_frame(Interface)
root.mainloop()


mich würde es freuen wenn mir jemand helfen könnte, das gesamte Interface in weiß zu gestalten
LG
Benutzeravatar
wuf
User
Beiträge: 1529
Registriert: Sonntag 8. Juni 2003, 09:50

Hi Budzi93

Kannst du einmal folgendes hinzufügen:

Code: Alles auswählen

root = Tk()
root.geometry("1920x1080")
root.title("Interface")
root.configure(background="white")
root.option_add("*background", 'white') #neu
Gruss wuf :-)
Take it easy Mates!
Budzi93
User
Beiträge: 6
Registriert: Dienstag 23. April 2019, 14:38

wuf hat geschrieben: Dienstag 23. April 2019, 17:30 Hi Budzi93

Kannst du einmal folgendes hinzufügen:

Code: Alles auswählen

root = Tk()
root.geometry("1920x1080")
root.title("Interface")
root.configure(background="white")
root.option_add("*background", 'white') #neu
Gruss wuf :-)
vielen Dank, es hat funktioniert :P
Antworten