'MacOS Button Background-colour Not Changing

I am creating an application with a user-sign up form, my application is made in python. To create the GUI I have used tkinter, however, a problem arose when formatting the buttons, namely, the background colour not changing.

I initially solved this by using the tkmacosx module; however, after a while, it suddenly stopped working seemingly out of nowhere. Even reverting to previous rendtitions of my code the problem persists.

I am on a Mac with macOS 12.0.1.

Attached is the code in question:

class LoginWindow:
    def __init__(self, root):
        self.root = root
        self.root.title("Login")
        self.root.geometry("1550x800+0+0")

        self.bg = PIL.ImageTk.PhotoImage(file=r"/Users/rakesharavind/Downloads/pastel-memphis-blog-banner-template/nea_bg2.jpg")
        lbl_bg = Label(self.root, image = self.bg)
        lbl_bg.place(x=0, y=0, relwidth=1, relheight=1)

        frame = Frame(self.root, bg="light blue")
        frame.place(x=550, y=100, width=340, height=530)

        img1 = PIL.Image.open(r"/Users/rakesharavind/Downloads/person_icon3.png")
        img1 = img1.resize((100,100), PIL.Image.ANTIALIAS)
        self.photoimage1 = PIL.ImageTk.PhotoImage(img1)
        lbl_img1 = Label(image=self.photoimage1, bg="light blue", borderwidth=0)
        lbl_img1.place(x=667, y=105, width=100, height=100)

        texttop = Label(frame,text="Get Started", font=("veranda", 30, "bold"), fg="black", bg="light blue")
        texttop.place(x=85, y=100)

        username = lbl = Label(frame,text="Username", font=("veranda", 25, "bold"), fg="black", bg="light blue")
        username.place(x=15, y=150)

        self.textuser = ttk.Entry(frame, font=("veranda", 25))
        self.textuser.place(x=15, y=190, width=300)

        password = lbl = Label(frame, text="Password", font=("veranda", 25, "bold"), fg="black", bg="light blue")
        password.place(x=15, y=245)

        self.textpass = ttk.Entry(frame, font=("veranda", 25))
        self.textpass.place(x=15, y=285, width=300)

        LoginBtn = Button(frame, text="Login", command=self.login, font=("veranda", 25, "bold"), fg="black", bg="#3895d3", activeforeground="white", activebackground="#9e7bb5")
        LoginBtn.place(x=110, y=350, width=120, height=50)

        RegisterBtn = Button(frame, text="New User Registeration", command=self.registerWindow, font=("veranda", 15, "bold"), anchor="w", fg="black", bg="light blue", activeforeground="white", activebackground="#3895d3")
        RegisterBtn.place(x=15, y=440, width=180, height=30)

        ForgotBtn = Button(frame, text="Forgot Password?", command=self.forgotPassword, font=("veranda", 15, "bold"), anchor="w", fg="black", background="light blue", activeforeground="white", activebackground="#3895d3")
        ForgotBtn.place(x=15, y=475, width=140, height=30)

The following is the import command I am using:

from tkinter import*

import PIL.ImageTk
import PIL.Image

from tkmacosx import Button

I am doing this project via following various tutorial, so I do not have much experience.

Any help would be greatly appreciated, Thank You!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source