💄 Add progressbar as timer #35
@ -1,5 +1,5 @@
|
|||||||
pillow~=9.5.0
|
pillow~=10.0.1
|
||||||
pyinstaller==5.12.0
|
pyinstaller==5.13.1
|
||||||
pygame~=2.4.0
|
pygame~=2.4.0
|
||||||
customtkinter~=5.1.3
|
customtkinter~=5.1.3
|
||||||
configparser~=5.3.0
|
configparser~=5.3.0
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import copy
|
import copy
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
|
||||||
|
import PIL
|
||||||
from PIL import ImageTk, Image, ImageOps
|
from PIL import ImageTk, Image, ImageOps
|
||||||
|
|
||||||
|
|
||||||
@ -16,6 +18,9 @@ class ImagePlaceholder:
|
|||||||
self.image_label.pack(side=TOP, fill=BOTH, expand=1)
|
self.image_label.pack(side=TOP, fill=BOTH, expand=1)
|
||||||
|
|
||||||
def display_new_image(self):
|
def display_new_image(self):
|
||||||
|
if len(self.images) == 0:
|
||||||
|
self.image_window.on_closing()
|
||||||
|
return
|
||||||
image_path = self.images.pop(0)
|
image_path = self.images.pop(0)
|
||||||
if image_path == "break":
|
if image_path == "break":
|
||||||
self.is_break = True
|
self.is_break = True
|
||||||
@ -35,7 +40,7 @@ class ImagePlaceholder:
|
|||||||
if w < 21 or h < 21:
|
if w < 21 or h < 21:
|
||||||
w = 1280
|
w = 1280
|
||||||
h = 1024
|
h = 1024
|
||||||
self.current_image.thumbnail((w - 20, h - 20), Image.ANTIALIAS)
|
self.current_image.thumbnail((w - 20, h - 20), PIL.Image.Resampling.LANCZOS)
|
||||||
|
|
||||||
if reload:
|
if reload:
|
||||||
self.load_widget()
|
self.load_widget()
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import copy
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
|
from tkinter.ttk import Progressbar, Style
|
||||||
|
|
||||||
from CTkToolTip import *
|
|
||||||
from PIL import ImageTk, Image, ImageOps
|
|
||||||
import customtkinter
|
import customtkinter
|
||||||
|
from CTkToolTip import *
|
||||||
|
from PIL import ImageTk, Image
|
||||||
|
|
||||||
from src.util import Util
|
from src.util import Util
|
||||||
|
|
||||||
|
|
||||||
@ -65,13 +66,23 @@ class Toolbar:
|
|||||||
text_color=Util.get_default_button_color())
|
text_color=Util.get_default_button_color())
|
||||||
self.timer_label.pack(side=RIGHT, ipadx=20)
|
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):
|
def display_new_timer(self):
|
||||||
|
if len(self.timers) == 0:
|
||||||
|
return
|
||||||
self.timer = self.timers.pop(0)
|
self.timer = self.timers.pop(0)
|
||||||
self.timer_label.configure(text=Util.format_seconds(self.timer))
|
self.timer_label.configure(text=Util.format_seconds(self.timer))
|
||||||
self.timer_check = self.image_window.window.after(1000, self.update_timer, self.timer)
|
self.timer_check = self.image_window.window.after(1000, self.update_timer, self.timer)
|
||||||
|
|
||||||
def update_timer(self, current):
|
def update_timer(self, current):
|
||||||
current -= 1
|
current -= 1
|
||||||
|
self.progressbar['value'] = 100 - (current * 100 / self.timer)
|
||||||
if current == 10:
|
if current == 10:
|
||||||
self.image_window.play_countdown()
|
self.image_window.play_countdown()
|
||||||
if current > 0:
|
if current > 0:
|
||||||
@ -103,8 +114,11 @@ class Toolbar:
|
|||||||
try:
|
try:
|
||||||
self.timer_label.pack_info()
|
self.timer_label.pack_info()
|
||||||
self.timer_label.pack_forget()
|
self.timer_label.pack_forget()
|
||||||
|
self.progressbar.pack_info()
|
||||||
|
self.progressbar.pack_forget()
|
||||||
except TclError:
|
except TclError:
|
||||||
self.timer_label.pack(side=RIGHT, ipadx=20)
|
self.timer_label.pack(side=RIGHT, ipadx=20)
|
||||||
|
self.progressbar.pack(side=RIGHT, ipadx=20)
|
||||||
|
|
||||||
def open_folder(self):
|
def open_folder(self):
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
|
Loading…
Reference in New Issue
Block a user