Here are two images used. ( Right click and save images in PNG format )
Tkinter button with ON OFF images switch to configure window background colour for night mode
We can use this as Night Mode switch and change the window background colour. Here the variables are set to two different colours, this can be changed to match your requirements.
import tkinter as tk
my_w = tk.Tk()
my_w.geometry("400x300") # Size of the window
colour_night='lightgreen' # Change the night colour
colour_day='blue' # change the day colour
my_w.configure(background=colour_day) # default background of window
my_img_on = tk.PhotoImage(file = "D:\\testing\\on-off-on.png")
my_img_off = tk.PhotoImage(file = "D:\\testing\\on-off-off.png")
def my_upd():
if(b1['bg']==colour_day):
b1.config(image=my_img_on,bg=colour_night,activebackground=colour_night)
my_w.configure(background=colour_night)
else:
b1.config(image=my_img_off,bg=colour_day,activebackground=colour_day)
my_w.configure(background=colour_day)
b1=tk.Button(my_w,image=my_img_off,
relief='flat',bg=colour_day,command=lambda:my_upd())
b1.grid(row=1,column=1,padx=20,pady=10)
my_w.mainloop() # Keep the window open