💄 Add progressbar as timer
+ remove one bug and updates dependencies
This commit was merged in pull request #35.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import copy
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from tkinter import *
|
||||
from tkinter.ttk import Progressbar, Style
|
||||
|
||||
from CTkToolTip import *
|
||||
from PIL import ImageTk, Image, ImageOps
|
||||
import customtkinter
|
||||
from CTkToolTip import *
|
||||
from PIL import ImageTk, Image
|
||||
|
||||
from src.util import Util
|
||||
|
||||
|
||||
@@ -65,13 +66,23 @@ class Toolbar:
|
||||
text_color=Util.get_default_button_color())
|
||||
self.timer_label.pack(side=RIGHT, ipadx=20)
|
||||
|
||||
style = Style()
|
||||
style.theme_use('default')
|
||||
style.configure("black.Horizontal.TProgressbar", background='black')
|
||||
|
||||
self.progressbar = Progressbar(toolbar, length=280)
|
||||
self.progressbar.pack(side=RIGHT, ipadx=20)
|
||||
|
||||
def display_new_timer(self):
|
||||
if len(self.timers) == 0:
|
||||
return
|
||||
self.timer = self.timers.pop(0)
|
||||
self.timer_label.configure(text=Util.format_seconds(self.timer))
|
||||
self.timer_check = self.image_window.window.after(1000, self.update_timer, self.timer)
|
||||
|
||||
def update_timer(self, current):
|
||||
current -= 1
|
||||
self.progressbar['value'] = 100 - (current * 100 / self.timer)
|
||||
if current == 10:
|
||||
self.image_window.play_countdown()
|
||||
if current > 0:
|
||||
@@ -103,8 +114,11 @@ class Toolbar:
|
||||
try:
|
||||
self.timer_label.pack_info()
|
||||
self.timer_label.pack_forget()
|
||||
self.progressbar.pack_info()
|
||||
self.progressbar.pack_forget()
|
||||
except TclError:
|
||||
self.timer_label.pack(side=RIGHT, ipadx=20)
|
||||
self.progressbar.pack(side=RIGHT, ipadx=20)
|
||||
|
||||
def open_folder(self):
|
||||
if sys.platform == "win32":
|
||||
|
||||
Reference in New Issue
Block a user