当前位置:   article > 正文

python怎么更改主题_如何更改tkinter应用程序的整体主题?

tkinter更换主题

A number of operations related to themes require that you have

available an instance of the ttk.Style() class (in the Python sense of

class). For example, to obtain a list of the available themes in your

installation:

>>> import ttk # import tkinter.ttk as ttk for Python 3

>>> s=ttk.Style()

>>> s.theme_names()

('clam', 'alt', 'default', 'classic')

The .theme_names() method returns a tuple containing the names of the

available styles. The 'classic' theme gives you the original, pre-ttk

appearance.

To determine which theme you get by default, use the .theme_use()

method with no arguments. To change the current theme, call this same

method with the desired theme name as the argument:

>>> s.theme_use()

'default'

>>> s.theme_use('alt')

>>> s.theme_use()

'alt'

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/718696
推荐阅读
相关标签
  

闽ICP备14008679号