Finley Adams
Finley Adams

Reputation: 831

Tkinter buttons are completely white Mac

I'm creating a simple UI, my problem is that buttons are always white also if I change all their color properties...I'm new in Tkinter maybe I'm missing something.

This is the code, you can just copy and run:

import tkinter
tk = tkinter.Tk()


def browseFiles():
    print("Browsing...")


browseButton = tkinter.Button(
    tk, text="Browse files", command=browseFiles, fg='#03045e', bg='#caf0f8', background='#ef233c', activeforeground='blue').pack()

tk.mainloop()

This is a picture of result:enter image description here

MacOS version : 11.5.2 withPython 3.10.0rc2, tcl-tk 8.6.11_1 and when I run the code this is the warning :

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

Maybe I should downgrade to a python stable version ?

Upvotes: 2

Views: 606

Answers (1)

Finley Adams
Finley Adams

Reputation: 831

Solved :

pip3 install tkmacosx

This will install some extensions that will fix the problem. Just one thing be sure to switch interpreter, maybe you're not using the right one. In my case it worked when I used this one enter image description here. Check where tkmacosx has been installed, you should use the same interpreter version I guess.

Upvotes: 4

Related Questions