fixed CTkDialog example for Windows

This commit is contained in:
TomSchimansky 2022-02-21 16:05:05 +01:00
parent 356ed917be
commit 5007d16df3

View File

@ -24,7 +24,7 @@ class CTkDialog:
self.fg_color = CTkColorManager.MAIN if fg_color == "CTkColorManager" else fg_color self.fg_color = CTkColorManager.MAIN if fg_color == "CTkColorManager" else fg_color
self.hover_color = CTkColorManager.MAIN_HOVER if hover_color == "CTkColorManager" else hover_color self.hover_color = CTkColorManager.MAIN_HOVER if hover_color == "CTkColorManager" else hover_color
self.top = tkinter.Toplevel() self.top = customtkinter.CTkToplevel()
self.top.geometry(f"280x{self.height}") self.top.geometry(f"280x{self.height}")
self.top.resizable(False, False) self.top.resizable(False, False)
self.top.title(title) self.top.title(title)
@ -32,14 +32,16 @@ class CTkDialog:
self.top.focus_force() self.top.focus_force()
self.top.grab_set() self.top.grab_set()
self.label_frame = tkinter.Frame(master=self.top, self.label_frame = customtkinter.CTkFrame(master=self.top,
width=300, corner_radius=0,
height=self.height-100) width=300,
height=self.height-100)
self.label_frame.place(relx=0.5, rely=0, anchor=tkinter.N) self.label_frame.place(relx=0.5, rely=0, anchor=tkinter.N)
self.button_and_entry_frame = tkinter.Frame(master=self.top, self.button_and_entry_frame = customtkinter.CTkFrame(master=self.top,
width=300, corner_radius=0,
height=100) width=300,
height=100)
self.button_and_entry_frame.place(relx=0.5, rely=1, anchor=tkinter.S) self.button_and_entry_frame.place(relx=0.5, rely=1, anchor=tkinter.S)
self.myLabel = CTkLabel(master=self.label_frame, self.myLabel = CTkLabel(master=self.label_frame,
@ -96,6 +98,7 @@ if __name__ == "__main__":
customtkinter.set_appearance_mode("System") customtkinter.set_appearance_mode("System")
app = customtkinter.CTk() app = customtkinter.CTk()
app.geometry("400x300")
app.title("CTkDialog Test") app.title("CTkDialog Test")
def button_click_event(): def button_click_event():
@ -106,4 +109,3 @@ if __name__ == "__main__":
button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER) button.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
app.mainloop() app.mainloop()
customtkinter.disable_macos_darkmode()