Welcome screen added

This commit is contained in:
Profitroll
2023-01-22 20:06:55 +01:00
parent 1be317898f
commit e97c218ab3
9 changed files with 138 additions and 4 deletions

View File

@@ -0,0 +1,40 @@
import tkinter as tk
from PIL import Image, ImageTk
from itertools import count, cycle
class ImageLabel(tk.Label):
"""
A Label that displays images, and plays them if they are gifs
:im: A PIL Image instance or a string filename
"""
def load(self, im):
if isinstance(im, str):
im = Image.open(im)
frames = []
try:
for i in count(1):
frames.append(ImageTk.PhotoImage(im.copy()))
im.seek(i)
except EOFError:
pass
self.frames = cycle(frames)
try:
self.delay = im.info['duration']
except:
self.delay = 100
if len(frames) == 1:
self.config(image=next(self.frames))
else:
self.next_frame()
def unload(self):
self.config(image=None)
self.frames = None
def next_frame(self):
if self.frames:
self.config(image=next(self.frames))
self.after(self.delay, self.next_frame)

View File

@@ -1,5 +1,4 @@
from ttkthemes import ThemedTk
from typing import Union
from tkinter import Misc
import sv_ttk
from tkinter.ttk import Frame
@@ -7,7 +6,7 @@ from modules.utils import get_string_mode
class ThemedFrame(Frame):
def __init__(self, master: ThemedTk, **kwargs) -> None:
def __init__(self, master: Misc, **kwargs) -> None:
super().__init__(master, **kwargs)

View File

@@ -0,0 +1,13 @@
from tkinter import Misc, Toplevel
import sv_ttk
from modules.theme_titlebar import theme_title_bar
from modules.utils import get_string_mode, use_dark_mode
class ThemedToplevel(Toplevel):
def __init__(self, master: Misc, **kwargs) -> None:
super().__init__(master, **kwargs)
sv_ttk.set_theme(get_string_mode())