Python tkinter ttk 主题是否基于操作系统可用 [英] Are Python tkinter ttk themes available based on the operating system

查看:27
本文介绍了Python tkinter ttk 主题是否基于操作系统可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

注意:我刚开始编写 GUI.

解决方案

我不认为它们是(全部)跨平台的,不仅从我的经验来看,而且从论文

<块引用>

Tile 包包括几个内置主题.X11 上的默认主题具有全新、简化的外观;一个 经典 主题实现了 Tk 的当前 Motif-like 外观也是可用的.

在 Windows XP 上,xpnative 主题使用 Windows视觉样式"API 使 Tk 小部件与本机控件无法区分.在其他版本的 Windows 上,winnative 主题符合 Microsoft Windows 用户体验指南.

在 Mac OSX 上,aqua 主题使用 Carbon Appearance Manager(几乎)在该平台上的原生外观.

新主题可以作为用 Tcl 或 C 编写的附加包来实现,具体取决于所需的自定义级别.

Tile 主题是元素、布局和样式的集合,它们与小部件选项相结合以确定外观.

所以,总而言之,有适用于不同操作系统的自定义主题.您也可以使用 C 或 Tcl 来实现您的.

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.

解决方案

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

So, in conclusion, there are custom themes for different operating systems. You can also implement yours using C or Tcl.

这篇关于Python tkinter ttk 主题是否基于操作系统可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆