Files
VRCT/vrct_gui/_CreateWindowCover.py
2023-10-14 08:10:57 +09:00

58 lines
1.9 KiB
Python

from customtkinter import CTkToplevel, CTkFrame, CTkLabel, CTkFont
from .ui_utils import fadeInAnimation
class _CreateWindowCover(CTkToplevel):
def __init__(self, attach_window, settings, view_variable):
super().__init__()
self.withdraw()
self.title("")
self.overrideredirect(True)
# self.wm_attributes("-alpha", 0.5)
self.wm_attributes("-toolwindow", True)
self.attach_window = attach_window
self.configure(fg_color="#ff7f50")
self.protocol("WM_DELETE_WINDOW", lambda e: self.withdraw())
self.settings = settings
self._view_variable = view_variable
self.attach_window.update_idletasks()
self.x_pos = self.attach_window.winfo_rootx()
self.y_pos = self.attach_window.winfo_rooty()
self.width_new = self.attach_window.winfo_width()
self.height_new = self.attach_window.winfo_height()
self.geometry("{}x{}+{}+{}".format(self.width_new, self.height_new, self.x_pos, self.y_pos))
self.grid_rowconfigure(0,weight=1)
self.grid_columnconfigure(0,weight=1)
self.cover_container = CTkFrame(self, corner_radius=0, fg_color="black", width=0, height=0)
self.cover_container.grid(row=0, column=0, sticky="nsew")
self.cover_container_label_wrapper = CTkLabel(
self.cover_container,
textvariable=self._view_variable.VAR_LABEL_MAIN_WINDOW_COVER_MESSAGE,
height=0,
corner_radius=0,
font=CTkFont(family=self.settings.FONT_FAMILY, size=self.settings.uism.TEXT_FONT_SIZE, weight="normal"),
anchor="w",
text_color=self.settings.ctm.TEXT_COLOR,
)
self.cover_container_label_wrapper.place(relx=0.5, rely=0.5, anchor="center")
def show(self):
self.attributes("-alpha", 0)
self.deiconify()
fadeInAnimation(self, steps=5, interval=0.005, max_alpha=0.5)