簡體   English   中英

是否可以在python中更改ttk.progressBar浮雕?

[英]Is it possible to change the ttk.progressBar relief in python?

我有一個使用此代碼的進度欄:

s = ttk.Style()
s.theme_use('alt')
s.configure("blue.Horizontal.TProgressbar", troughcolor='#4d4d4d', background='#2f92ff', relief="flat")

Pb = ttk.Progressbar(root, style="blue.Horizontal.TProgressbar", orient ="horizontal", length=350, mode="determinate")

Pb.pack()

當前看起來像這樣:

在此處輸入圖片說明

如果您很難看到以下內容,則這是不同的浮雕效果:

在此處輸入圖片說明

目前看來是“沉沒”。 我希望它是“平坦的”。 我已經閱讀了ttk的文檔,但是找不到進度條所特有的任何內容,所以我想知道這是否有可能。

您正在尋找troughrelief選項而不是relief

請嘗試以下操作:

from tkinter import ttk
import tkinter as tk

root = tk.Tk()

s = ttk.Style()
s.theme_use('alt')
s.configure('blue.Horizontal.TProgressbar',
        troughcolor  = '#4d4d4d',
        troughrelief = 'flat',
        background   = '#2f92ff')

pb = ttk.Progressbar(root,
        style  = 'blue.Horizontal.TProgressbar',
        orient = 'horizontal',
        length =  350,
        mode   = 'indeterminate')
pb.pack()
pb.start()

root.mainloop()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM