How can I make the colour of a radiobutton dot change colour in Tkinter?

50 Views Asked by At

I have the following code;

import tkinter as tk

window = tk.Tk()
window.title("Number Guessing Game")
window.geometry("300x300")
window.config(bg="#6FAFE7")

selected_difficulty = tk.IntVar()

easy = tk.Radiobutton(text="Easy", value=0, variable=selected_difficulty, padx=3, pady=10, bg="#2176C1", fg="white")
easy.grid(row=1, column=0)
medium = tk.Radiobutton(text="Medium", value=1, variable=selected_difficulty, padx=3, pady=10, bg="#2176C1", fg="white")
medium.grid(row=1, column=1)
hard = tk.Radiobutton(text="Hard", value=2, variable=selected_difficulty, padx=3, pady=10, bg="#2176C1", fg="white")
hard.grid(row=1, column=2)

tk.mainloop()

The issue is that since the colour of the radiobutton is white, it's impossible to tell what radiobutton has been selected. How can I change this so that the selected radio button has a small yellow dot beside it or something along those lines? I haven't been able to find anything about this on any of the Tkinter docs.

0

There are 0 best solutions below