How can I increase the border width of progress bar in Thinker using Python. Below you can see my code, I have used length = 1360 and bd = 5 parameters but I can't manage to get the thickness I desired from the progress bar.
from tkinter import ttk
from tkinter.ttk import *
from tkinter import *
import tkinter
root = Tk() root.configure(background = "sky blue")
root.wm_attributes("-fullscreen","true")
progress = Progressbar(root, orient = HORIZONTAL, length = 1360,
maximum=150, mode = "determinate",
style="TProgressbar", bd=5)
def bar():
import time progress["value"] = 60 root.update_idletasks()
time.sleep(1)
progress["value"] = 150
root.update_idletasks()
time.sleep(1)
root.destroy()
progress.pack(pady=4)
class HoverButton(tkinter.Button):
def init(self, master, **kw):
tkinter.Button.init(self,master=master,**kw)
self.defaultBackground = self["background"]
self.bind("", self.on_enter)
self.bind("", self.on_leave)
def on_enter(self, e):
self["background"] = self["activebackground"]
def on_leave(self, e):
self["background"] = self.defaultBackground
classButton = HoverButton(root,text="Start",padx=6,pady=1,
bd=7,font=("Eras Demi ITC",14,"bold"),
width=14, activebackground="purple",command=bar)
classButton.pack(pady=5)
root.mainloop()
Create a Canvas (with a window in it) and add progressbar to that. In this way you can control the width, you desired.
canvas = Tkinter.Canvas(self, relief = Tkinter.FLAT, width = 1200, height = 5)
progressbar = Progressbar(canvas, orient=Tkinter.HORIZONTAL,
length=1360, mode="determinate" )
canvas.create_window(1, 1, anchor=Tkinter.NW, window=progressbar)
canvas.grid()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.