Welcome screen added
This commit is contained in:
40
classes/custom/image_label.py
Normal file
40
classes/custom/image_label.py
Normal 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)
|
@@ -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)
|
||||
|
||||
|
13
classes/custom/themed_toplevel.py
Normal file
13
classes/custom/themed_toplevel.py
Normal 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())
|
Reference in New Issue
Block a user