Sun-Valley-ttk-theme icon indicating copy to clipboard operation
Sun-Valley-ttk-theme copied to clipboard

File selection box unreadable on X11 with dark ttk theme

Open mak448a opened this issue 1 year ago • 5 comments

[EDIT] I didn't include operating system info

Fedora 38 KDE, Python 3.11.4

image

from tkinter import *
from tkinter import ttk
import platform
from PIL import ImageTk, Image
import sv_ttk
from tkinter import filedialog

root = Tk()
# root.geometry("800x800")
root.title("Image viewer")

sv_ttk.set_theme("dark")

root.filename = filedialog.askopenfilename(initialdir="~")

root.mainloop()

mak448a avatar Jul 21 '23 02:07 mak448a

Also adding, that after selecting and deselecting items again, the text remains black. May even be a bug in Tk, because the widget seems to be initialized with the wrong colors.

rdbende avatar Jul 24 '23 11:07 rdbende

It's on Wayland, too. But it's running on XWayland, so I guess that doesn't really count. Also, great theme!

mak448a avatar Jul 24 '23 18:07 mak448a

I use Wayland too (Fedora 38 GNOME Wayland session), but indeed, it's running on XWayland, since Tk doesn't have a Wayland native implementation.

rdbende avatar Jul 24 '23 18:07 rdbende

Wow didn't know you used Fedora too

mak448a avatar Jul 24 '23 18:07 mak448a

I was able to get this result: Dark_Theme_Filepicker using code like this:

from threading import Timer

def open_file():
    def change_theme():
        sv_ttk.set_theme('dark')
    sv_ttk.set_theme('light')
    t = Timer(0, change_theme)
    t.start()
    file_path = filedialog.askopenfilename(args**)

It's nowhere near ideal, seeing as how the whole app has to change themes, but it does work.

ethical-haquer avatar Dec 09 '23 16:12 ethical-haquer