0

how can I change the background of a button? I tried everything from tutorials I have found but nothing works.

class MyFirstGUI:
    def __init__(self, master):
        self.master = master
        master.title("A simple GUI")

        self.okayButton = Button(master, text="awdawdaw",bg='blue', activebackground='cyan')
        self.okayButton.pack()
    
if __name__ == '__main__':
    print_hi('Hello')

    root = Tk()

    root.geometry("800x480")
    my_gui = MyFirstGUI(root)
    root.mainloop()
Torben G
  • 750
  • 2
  • 11
  • 33
  • With your code, I see a button with a blue background. What do you see? What OS are you running on? OSX? – scotty3785 Dec 08 '20 at 08:56
  • yes mac osx I see a normal default button with white bg and black coor – Torben G Dec 08 '20 at 09:06
  • If your platform is MacOS, then you cannot change the background color of a button. See answer [here](https://stackoverflow.com/questions/1529847/how-to-change-the-foreground-or-background-colour-of-a-tkinter-button-on-mac-os). – acw1668 Dec 08 '20 at 09:14

0 Answers0