Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filedialog window has white text on white background (for dark mode) #35

Open
OleMussmann opened this issue May 12, 2022 · 7 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@OleMussmann
Copy link

The tkinter filedialog pop-up has a white background, even when styled in the dark Azure theme. This makes the white filename-texts unreadable.

@rdbende
Copy link
Owner

rdbende commented May 30, 2022

I assume this happens on Linux, though I wasn't able to reproduce it. Could you please attach some example code?

@OleMussmann
Copy link
Author

OleMussmann commented May 30, 2022

Thanks for the reply, @rdbende . I should have included more information to begin with.

  • Tested Python versions: 3.6.9, 3.10.3
  • Host system: Ubuntu 20.04

The askdirectory dialog has a white background. The font is white or invisible, rendering the text unreadable. Once selected or clicked on, the text changes to black (and staying black!), making it readable. See screenshot attached.

bug_35

import tkinter as tk
from tkinter import ttk, filedialog


class App(ttk.Frame):
    def __init__(self, parent):
        ttk.Frame.__init__(self)
        self.widgets_frame = ttk.Frame(self)
        self.widgets_frame.grid()
        self.button = ttk.Button(self.widgets_frame, text="Open Folder",
                                 command=filedialog.askdirectory)
        self.button.grid(row=0, column=0, padx=5, pady=10, sticky="nsew")


if __name__ == "__main__":
    root = tk.Tk()

    root.tk.call("source", "azure.tcl")
    root.tk.call("set_theme", "dark")

    app = App(root)
    app.pack(fill="both", expand=True)

    root.mainloop()

@rdbende
Copy link
Owner

rdbende commented May 30, 2022

Ohh yess, now I see. Tho it's really strange. Why do do that item remain black when unselected? 🤔
Now I don't even know what that widget is. Kinda looks like a Treeview, wrapped into an Entry, but then why it isn't themed?

Now I'm a bit confused, lol 🥴

@rdbende rdbende added bug Something isn't working help wanted Extra attention is needed bad design The design is ugly or something is barely visible labels Jun 27, 2022
@rdbende rdbende removed the bad design The design is ugly or something is barely visible label Jul 14, 2022
@rdbende
Copy link
Owner

rdbende commented Nov 1, 2022

@pabloo87
Copy link

pabloo87 commented May 9, 2023

I found this workaround:
I commented in azure.tcl the next block
#tk_setPalette background [ttk::style lookup . -background] \ #foreground [ttk::style lookup . -foreground] \ #highlightColor [ttk::style lookup . -focuscolor] \ #selectBackground [ttk::style lookup . -selectbackground] \ #selectForeground [ttk::style lookup . -selectforeground] \ #activeBackground [ttk::style lookup . -selectbackground] \ #activeForeground [ttk::style lookup . -selectforeground]
Lines 35-41

@rdbende
Copy link
Owner

rdbende commented Jul 3, 2023

Turns out it's some kind of canvas thingy.

@rdbende
Copy link
Owner

rdbende commented Jul 3, 2023

I could hack the canvas to make the background dark, but then it wouldn't work after an item is selected.
Probably it's gonna be a ticket in Tk's source repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants