Home > Software engineering >  Tkinter Dark Theme by Default with Python 3.10?
Tkinter Dark Theme by Default with Python 3.10?

Time:10-28

I've just updated Python to 3.10 and when I run Tkinter programs they appear with a dark theme which I've never seen before. I'd like to go back to the standard light theme but I can't figure out how to. There doesn't seem to be any obvious documentation online regarding this.

Here is some quick sample code that just displays a grid to reproduce the dark theme (I'm using Python 3.10 and Visual Studio Code 1.61.2):

from tkinter import *

root = Tk()

class Something:
    def __init__(self, parent, col, row):
        canvas = Canvas(parent, bd=1, relief=SOLID, highlightthickness=0, width=30, height=30)
        canvas.grid(column=col, row=row)

frame = Frame(root, bd=1, relief=SOLID)
frame.grid(padx=50, pady=50)

for i in range(11):
    for j in range(11):
        Something(frame, i, j)

root.mainloop()

GUI with the dark theme

CodePudding user response:

There might be a problem with your default system UI.

I don't have a MAC so I can't test this, but try changing your default system ui to light, if MAC even has that option...

  • Related