Hi, thanks for this awesome looking theme. While I've been testing my program with this theme, I noticed a bit odd issue.
When switching themes, color of tk.Menu gets a little bit off.
When switching from dark to light: menu is white (i'm not sure but i think it should be light gray)
When switching from light to dark: menu is a little bit darker than original
and that's kinda OK but the real issue is switching once again. Text color changes but background color doesn't so text is unreadable.
From that point, color is fixed to slightly off color and only the text color changes.
I wasn't sure if the issue was on my code's side or theme's side so I made a dirty but quick test code using your example.
import tkinter as tk
from tkinter import ttk
import sv_ttk
THEME = 'dark'
class App(ttk.Frame):
def __init__(self, parent):
ttk.Frame.__init__(self, parent)
# Create widgets
self.setup_widgets()
def setup_widgets(self):
# Create a Frame for input widgets
self.widgets_frame = ttk.Frame(self)
self.widgets_frame.pack(expand=True)
# Menu for the Menubutton
self.menu = tk.Menu(self)
self.menu.add_command(label="Menu item 1")
self.menu.add_command(label="Menu item 2")
self.menu.add_separator()
self.menu.add_command(label="Menu item 3")
self.menu.add_command(label="Menu item 4")
# Menubutton
self.menubutton = ttk.Menubutton(
self.widgets_frame, text="Menubutton", menu=self.menu, direction="below"
)
self.menubutton.grid(row=0, column=0, padx=5, pady=10, sticky="nsew")
# Button
self.button = ttk.Button(self.widgets_frame, text="Switch Theme", command=sv_ttk.toggle_theme)
self.button.grid(row=1, column=0, padx=5, pady=10, sticky="nsew")
def main():
root = tk.Tk()
root.title("Simple example")
sv_ttk.set_theme(THEME)
app = App(root)
app.pack(fill="both", expand=True)
root.update_idletasks() # Make sure every screen redrawing is done
width, height = root.winfo_width(), root.winfo_height()
x = int((root.winfo_screenwidth() / 2) - (width / 2))
y = int((root.winfo_screenheight() / 2) - (height / 2))
# Set a minsize for the window, and place it in the middle
root.minsize(250, 200)
root.geometry(f"+{x}+{y}")
menubar = tk.Menu(root)
menu = tk.Menu(menubar, tearoff=0)
menu.add_command(label='Menu item 1')
menu.add_command(label='Menu item 2')
menu.add_separator()
menu.add_command(label='Menu item 3')
menu.add_command(label='Menu item 4')
menubar.add_cascade(label='Menu', menu=menu)
root.config(menu=menubar)
root.mainloop()
if __name__ == "__main__":
main()
Sure I can have the user restart program each time they change theme but that's kind of a last option so wanted to see if there are no fix/workaround.