gpt4 book ai didi

python - 是否基于操作系统提供 Python tkinter ttk 主题

转载 作者:太空宇宙 更新时间:2023-11-03 10:54:57 26 4
gpt4 key购买 nike

我使用 Python 3.5.2 和 tkinter.ttk 模块在 Linux (Kubuntu 16.04) 上开发一个简单的 GUI 实用程序。我的 ttk.__version__ == 0.3.1。有四种可用的小部件主题:'clam'、'alt'、'classic'、'default'。我在别处看到其他安装有更多选择。

是否可以为每个操作系统下载和安装?我想知道其他主题是否不一定是跨平台的,并且可能是为某些操作系统设计的?

注意:我是编写 GUI 的新手。

最佳答案

我不认为它们(全部)是跨平台的,不仅根据我的经验,还根据以下摘自论文“The Tile Widget Set”(第 1-2 页),Joe English,2004 年(a有点旧,但我认为这些东西今天仍然有效)。

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.

enter image description here

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, the winnative 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.

因此,总而言之,存在针对不同操作系统的自定义主题。您也可以使用 C 或 Tcl 实现您的。

关于python - 是否基于操作系统提供 Python tkinter ttk 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42664085/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com