Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ed38d6ceafb9852b8db2ad9e6ddac154b2ec4964bfb9b7f6c1f2bb80532356be
Ticket: 3f7eca5475a5ead14708b914b20f8528c1b2f293
Tcl/Tk, Tkinter and X11 system colors
User & Date: serhiy.storchaka on 2026-09-20 10:59:11
Changes

  1. icomment:
    Tk loads the X resources (the RESOURCE_MANAGER property set by xrdb, or ~/.Xdefaults if it is not set) into its option database, so a wildcard entry such as <tt>*background: black</tt> applies to every Tk widget, as it does to every other X application which honours resources. It is not specific to Tkinter.
    
    The usual fix is to restrict such entries in .Xresources to the applications they are meant for, e.g. <tt>URxvt*background</tt> or <tt>XTerm*background</tt>, instead of <tt>*background</tt>.
    
    If you cannot change them, a more specific pattern for the Tk application class wins over the wildcard. Tkinter applications have the class <tt>Tk</tt> by default (the <tt>className</tt> argument of <tt>tkinter.Tk</tt>), so this in .Xresources restores the defaults for all of them:
    <verbatim>
    Tk*background: #d9d9d9
    Tk*foreground: black
    Tk*Entry.background: white
    Tk*Text.background: white
    Tk*Listbox.background: white
    </verbatim>
    (a wish script has the class <tt>Wish</tt>, other scripts the capitalized script name). There is no separate system-wide Tk configuration file; on X11 the resource database is that mechanism.
    
  2. login: "serhiy.storchaka"
  3. mimetype: "text/x-fossil-wiki"
  4. status changed to: "Closed"