1.tk相关的样式说明
http://tktable.sourceforge.net/tile/
https://docs.python.org/3/library/tkinter.ttk.html#layouts
http://tktable.sourceforge.net/tile/doc/index.html

2.常用Themes
The tile package contains the following built-in themes
classic    the classic Motif-style appearance
default    a simpler, streamlined look for X11
alt    a "revitalized" look and feel similar to GTK+'s default theme and Windows NT appearance
winnative    which uses the native Win32 API to draw widgets
xpnative    which uses the Windows XP "Visual Styles" API
step    an experimental playground for testing out new ideas, such as NeXTStep-style scrollbars.

3.使用的例子

# 设置样式模板,常用的包括clam, alt, default, classic, vista, aqua, xpnative, winnative
s = ttk.Style()
if _platform == "win32":
    s.theme_use("vista")    # clam, alt, default, classic, vista, aqua, xpnative, winnative
elif _platform in [ "linux", "linux2" ]:
    s.theme_use("alt")
elif _platform == "darwin":
    s.theme_use("aqua")

# 设置进度条Progressbar样式
pbstyle = ttk.Style()
pbstyle.theme_use("classic")  # clam, alt, default, classic
pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")

# 设置标签Label样式
ttk.Style().configure("White.TLabel", background="white")

# 设置工具按钮Toolbutton样式
style = ttk.Style()
style.configure("InfoBar.Toolbutton", background=self._background)
style.configure("InfoClose.InfoBar.Toolbutton", anchor="center")

# 修改按钮默认样式
ttk.Style().configure("TButton", padding=6, relief="flat", background="#ccc")
style.map("C.TButton",
    foreground=[('pressed', 'red'), ('active', 'blue')],
    background=[('pressed', '!disabled', 'black'), ('active', 'white')]
    )
    
# 设置菜单按钮样式
style = ttk.Style()
style.layout("TMenubutton", [
   ("Menubutton.background", None),
   ("Menubutton.button", {"children":
       [("Menubutton.focus", {"children":
           [("Menubutton.padding", {"children":
               [("Menubutton.label", {"side": "left", "expand": 1})]
           })]
       })]
   }),
])

# 设置下来框TCombobox样式
style = ttk.Style()
style.theme_settings("default", {
   "TCombobox": {
       "configure": {"padding": 5},
       "map": {
           "background": [("active", "green2"),
                          ("!disabled", "green4")],
           "fieldbackground": [("!disabled", "green3")],
           "foreground": [("focus", "OliveDrab1"),
                          ("!disabled", "OliveDrab2")]
       }
   }
})

tkinter style样式使用相关推荐

  1. 几个比较冷门的prototype扩展方法:去掉html标签、去掉a标签、去掉style样式,以及判断是否为html代码的代码片段

    /*去掉html标签(真正意义上去掉所有html标签包括内嵌的css样式)*/ String.prototype.stripHTML = function (isRemoveNewLine) {var ...

  2. js改变style样式和css样式

    js可实现用户对页面中的选择条件改变页面中的样式,页面样式可以通过style修饰,也可以通过css修饰,先来看一下js改变style样式,代码如下: [html] view plaincopy < ...

  3. 007_Vue style样式绑定

    1. style样式绑定处理 1.1. 对象语法 <div v-bind:style="{width: '400px', height: '50px'}"></d ...

  4. WebStorm取消默认style样式折叠

    WebStorm取消默认style样式折叠: File--->Settings打开一个窗口 Edit--->CodeFolding 把HTML style attribute的前面的钩去掉 ...

  5. swiper6.0改造 “翻页按钮”:自定义style样式和position - 案例篇

    文章目录 swiper6.0改造 "翻页按钮":自定义style样式和position(含效果图.代码.使用手册) 需求场景 · 描述如下: 效果图 · gif 动画: 注意事项: ...

  6. style样式包(HTML、CSS)

    style样式包(CSS) * {margin: 0;padding: 0;text-decoration: none;} body{background-color: #f3f5f7;height: ...

  7. 1.1 css style 样式定义:行内 style 属性、单页 <style> 标签、多页 <style> 标签

    1.1 style 样式定义:行内 style 属性.单页 <style> 标签.多页 <style> 标签 文章目录 1.1 style 样式定义:行内 style 属性.单 ...

  8. JS获取DIV动态高度,并赋值到其style样式中

    <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312&qu ...

  9. WPF 绑定继承的样式提示 只能根据带有基类型 IFrameworkInputElement 的目标类型的 Style 样式

    在 WPF 中,如果有一个样式是继承另一个样式,而样式没有使用 TargetType 那么在运行的时候会提示 只能根据带有基类型 IFrameworkInputElement 的目标类型的 Style ...

最新文章

  1. python语法手册chm-python3.5.2官方帮助文档 参考手册(CHM版)
  2. nginx编译安装,nginx静态资源访问和负载均衡的使用!
  3. windows下的虚拟机中的ubuntu系统如何连接无线网(wifi)
  4. java解析csv文件写入mysql_java读取cvs文件并导入数据库
  5. BZOJ1492: [NOI2007]货币兑换Cash(CDQ分治,斜率优化动态规划)
  6. Contours 等高线图
  7. Linux查看实时网卡流量的几种方式
  8. 13个Python小游戏(含源码),开始敲起来,玩吧!
  9. ArcGIS软件中的坐标系及数据类型的概念
  10. Python读书笔记
  11. E20-591考试必备资料分享
  12. 从教女儿下棋谈启蒙教育
  13. 一台电脑绿色安装多个版本google Chorme方案
  14. 软件需求规格说明书,概要设计说明书,详细设计说明书(文档)
  15. 欧几里得(Euclid)算法的Python实现
  16. Matplotlib绘制自定义函数曲线
  17. 谢菲尔德大学计算机科学学院地理位置,2020年谢菲尔德大学在哪里及校区详细地址介绍...
  18. 网吧无盘系统的安装与使用(转)
  19. PHP 是最好的语言吗?
  20. 字节汽车商标被转让!字节跳动获得该商标

热门文章

  1. 封闭图形的填充问题研究
  2. php 解析word文件,php解析word文档
  3. abaqus直齿轮斜齿轮等相关模型调试,xfem裂纹扩展,磨损子程序
  4. 前端捕捉轨迹_web端百度地图API实现实时轨迹动态展现
  5. Matplotlib-01-matplotlib画图方式|图形结构
  6. algorand共识协议_基于Algorand结合VRF的共识机制介绍
  7. linux查看硬盘阵列卡信息命令,查看服务器RAID卡信息的SHELL脚本及MegaCLI命令介绍...
  8. 这些SCI写作万能句型,我都帮你总结好了!
  9. 嗖嗖嗖主题网外贸企业主题制作视频教程--第四讲 Wordpress首页模板文件index.php静态页面完善
  10. 童装服装企业php源码,童装英文外贸网站系统