添加进度条

This commit is contained in:
cxykevin 2024-04-07 21:38:29 +08:00
parent c60307aa4c
commit bc0f82125c
1 changed files with 8 additions and 8 deletions

View File

@ -58,7 +58,6 @@ class ProgressBar:
x_n += 1 x_n += 1
y_n += 1 y_n += 1
def __init__(self, master=None, root_anim=None, w=200, h=8, colors="primary", color_list: None | dict = None): def __init__(self, master=None, root_anim=None, w=200, h=8, colors="primary", color_list: None | dict = None):
self.w = max(200, w) self.w = max(200, w)
self.h = 8 self.h = 8
@ -67,7 +66,7 @@ class ProgressBar:
if (color_list is not None): if (color_list is not None):
self.color = color_list self.color = color_list
if (root_anim == None): if (root_anim == None):
self.__root = master self.__root = master.root
else: else:
self.__root = root_anim self.__root = root_anim
@ -94,7 +93,8 @@ class ProgressBar:
self.color["border_light"], "rightside", bgcolor=self.color["background"]) self.color["border_light"], "rightside", bgcolor=self.color["background"])
self.__fill_obj["fgbar"] = [ self.__fill_obj["fgbar"] = [
self.canvas.create_rectangle(4, 1, self.__progress_pixel+4, self.h-1, width=0, fill=self.color[self.colors])] self.canvas.create_rectangle(4, 1, self.__progress_pixel+4, self.h-1, width=0, fill=self.color[self.colors])]
self.__draw_corner(0, 0, 1, 0, self.color[self.colors], "leftside",bgcolor=self.color["background"]) self.__draw_corner(
0, 0, 1, 0, self.color[self.colors], "leftside", bgcolor=self.color["background"])
self.__draw_corner(1, 0, self.__progress_pixel+3, 0, self.__draw_corner(1, 0, self.__progress_pixel+3, 0,
self.color[self.colors], "rightprog") self.color[self.colors], "rightprog")