tkinter 3 ttk

Tk themed widgets通过Tkinter.ttk模块管理 和使用。

Tkinter有两个版本的widgets:

  • 老的传统的 tk 组合,1991年的版本就有了。
  • 新的ttk组件是在2007 的Tk 8.5中添加. ttk widgets可以替换很多的tk widgets.

ttk 表示 Tk themed. 

1、ttk和tk模块调用的例子

调用 tk和ttk模块:

import tkinter as tk
from tkinter import ttk
import tkinter as tk
from tkinter import ttk

root = tk.Tk()

tk.Label(root, text='Classic Label').pack()
ttk.Label(root, text='Themed Label').pack()

root.mainloop()

2、ttk模块有什么优势呢?

  • Separating the widget’s behavior and appearance – the ttk widgets attempt to separate the code that implements the widgets’ behaviors from their appearance through the styling system..
  • Native look & feel – the ttk widgets have the native look and feel of the platform on which the program runs.
  • Simplify
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值