mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import customtkinter
|
||||
|
||||
customtkinter.set_appearance_mode("dark")
|
||||
|
||||
|
||||
class ToplevelWindow(customtkinter.CTkToplevel):
|
||||
def __init__(self, *args, closing_event=None, **kwargs):
|
||||
@ -11,6 +13,9 @@ class ToplevelWindow(customtkinter.CTkToplevel):
|
||||
self.label = customtkinter.CTkLabel(self, text="ToplevelWindow")
|
||||
self.label.pack(padx=20, pady=20)
|
||||
|
||||
self.button_1 = customtkinter.CTkButton(self, text="set dark", command=lambda: customtkinter.set_appearance_mode("dark"))
|
||||
self.button_1.pack(side="top", padx=40, pady=40)
|
||||
|
||||
def closing(self):
|
||||
self.destroy()
|
||||
if self.closing_event is not None:
|
||||
@ -24,6 +29,10 @@ class App(customtkinter.CTk):
|
||||
|
||||
self.button_1 = customtkinter.CTkButton(self, text="Open CTkToplevel", command=self.open_toplevel)
|
||||
self.button_1.pack(side="top", padx=40, pady=40)
|
||||
self.button_2 = customtkinter.CTkButton(self, text="iconify toplevel", command=lambda: self.toplevel_window.iconify())
|
||||
self.button_2.pack(side="top", padx=40, pady=40)
|
||||
self.button_3 = customtkinter.CTkButton(self, text="set light", command=lambda: customtkinter.set_appearance_mode("light"))
|
||||
self.button_3.pack(side="top", padx=40, pady=40)
|
||||
|
||||
self.toplevel_window = None
|
||||
|
||||
|
@ -3,20 +3,20 @@ import customtkinter
|
||||
app = customtkinter.CTk()
|
||||
app.geometry("400x240")
|
||||
|
||||
app.withdraw()
|
||||
app.iconify()
|
||||
app.after(1000, app.deiconify)
|
||||
|
||||
|
||||
def button_function():
|
||||
top = customtkinter.CTkToplevel(app)
|
||||
top.withdraw()
|
||||
top.iconify()
|
||||
|
||||
app.after(1000, top.deiconify) # show toplevel
|
||||
app.after(1500, top.deiconify) # show toplevel
|
||||
app.after(2000, top.iconify) # hide toplevel
|
||||
app.after(2500, top.deiconify) # show toplevel
|
||||
app.after(3500, app.iconify) # hide app
|
||||
app.after(4000, app.deiconify) # show app
|
||||
app.after(5000, app.destroy) # destroy everything
|
||||
app.after(4500, top.lift) # show app
|
||||
|
||||
|
||||
button = customtkinter.CTkButton(app, command=button_function)
|
||||
|
Reference in New Issue
Block a user