问题
I'm using Python 3.5.2 with the tkinter.ttk
module to develop a simple GUI utility on Linux (Kubuntu 16.04). My ttk.__version__ == 0.3.1
. There are four widget themes available: 'clam', 'alt', 'classic', 'default'
. I had seen elsewhere that other installations have more to choose from.
Is that something available for download and install for every OS? I'm wondering if other themes aren't necessarily cross-platform, and might be designed for certain OS?
Note: I'm new to writing a GUI.
回答1:
I don't think they are (all) cross-platform, not only from my experience but also from the following excerpt from the paper "The Tile Widget Set" (pp. 1-2) by Joe English, 2004 (a little bit old, but I think these things still hold today).
Figure 1 shows 3 different buttons. The first is a classic Motif-style button. Notice the outer highlight ring (indicating keyboard focus) and the thick inner border (indicating that this is the "default" button). The second is a Windows-style button: it has a slightly different border and the focus indicator is a dashed box drawn inside the border instead of a solid box on the outside. The third button is a different possibility altogether.
Except those aren't really three different buttons: it's actually the same button drawn under three different themes.
The Tile package includes several built-in themes. The default theme on X11 has a new, streamlined look; a classic theme implementing Tk's current Motif-like appearance is also available.
On Windows XP, the
xpnative
theme uses the Windows "Visual Styles" API to make Tk widgets indistinguishable from native controls. On other versions of Windows, thewinnative
theme matches the Microsoft Windows User Experience guidelines.On Mac OSX, the
aqua
theme uses the Carbon Appearance Manager for (almost-)native appearance on that platform.New themes can be implemented as add-on packages written in Tcl or in C, depending on the level of customization required.
A Tile theme is a collection of elements, layouts, and styles, which are combined with widget options to determine the look and feel.
So, in conclusion, there are custom themes for different operating systems. You can also implement yours using C or Tcl.
来源:https://stackoverflow.com/questions/42664085/are-python-tkinter-ttk-themes-available-based-on-the-operating-system