1.以下代码为配置进度条的参数,需要from tkinter import ttk
style = ttk.Style(win)
style.layout('elem1.Horizontal.TProgressbar',
[('Horizontal.Progressbar.trough',
{'children': [('Horizontal.Progressbar.pbar',
{'side': 'left', 'sticky': 'ns'})],
'sticky': 'nswe'}),
('Horizontal.Progressbar.label', {'sticky': ''})])
2.假如控件名称为elem1,elem1.cofig()就显示以上配置的进度条了,以上进度条已配置百分比进度条内显示
elem1 = ttk.Progressbar(win, orient=HORIZONTAL, length=200, mode="determinate", maximum=100, value=0)
elem1.place(relx=0.3, rely=0.04, relwidth=0.16, relheight=0.03)
elem1.config(style='elem1.Horizontal.TProgressbar')
style.configure('elem1.Horizontal.TProgressbar', font=('Microsoft YaHei', 11))

最低0.47元/天 解锁文章
1204

被折叠的 条评论
为什么被折叠?



