Python tkinter ttk 主题是否基于操作系统可用

编程入门 行业动态 更新时间:2024-10-23 15:29:03
本文介绍了Python tkinter ttk 主题是否基于操作系统可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我使用带有 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 06:53:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390607.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:操作系统   主题   Python   tkinter   ttk

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!