Merge pull request 'remmoved unnessasary dependencies' (#15) from clean_code into main
Reviewed-on: http://192.168.178.135:3000/Fabelous/MPENN/pulls/15
This commit is contained in:
commit
5d1d6638bc
|
@ -1,40 +1,40 @@
|
||||||
import customtkinter as Ctk
|
import customtkinter as Ctk
|
||||||
from tkinter import messagebox
|
|
||||||
|
|
||||||
class ClosePopup(Ctk.CTkToplevel):
|
class ClosePopup(Ctk.CTkToplevel):
|
||||||
def __init__(self,master, callback, **kwargs, ):
|
def __init__(self,master, callback, **kwargs, ):
|
||||||
super().__init__(master, **kwargs)
|
super().__init__(master, **kwargs)
|
||||||
self.my_font = Ctk.CTkFont(family="Berlin Sans FB", size=22)
|
self.my_font = Ctk.CTkFont(family="Berlin Sans FB", size=22)
|
||||||
self.geometry("400x300")
|
self.geometry("400x300")
|
||||||
self.resizable(False, False)
|
self.resizable(False, False)
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
self.label = Ctk.CTkLabel(self, text="Do you want to leave?\n You might lose some Data", font=self.my_font)
|
self.label = Ctk.CTkLabel(self, text="Do you want to leave?\n You might lose some Data", font=self.my_font)
|
||||||
# Add exit button
|
# Add exit button
|
||||||
self.exit_button = Ctk.CTkButton(self, text="Exit",fg_color="#bd202d",hover_color="#f24150", command=self.confirm_exit, font=self.my_font)
|
self.exit_button = Ctk.CTkButton(self, text="Exit",fg_color="#bd202d",hover_color="#f24150", command=self.confirm_exit, font=self.my_font)
|
||||||
# Add leave button
|
# Add leave button
|
||||||
self.leave_button = Ctk.CTkButton(self, text="Stay", command=self.destroy, font=self.my_font)
|
self.leave_button = Ctk.CTkButton(self, text="Stay", command=self.destroy, font=self.my_font)
|
||||||
self.grab_set()
|
self.grab_set()
|
||||||
#aligning
|
#aligning
|
||||||
self.align()
|
self.align()
|
||||||
|
|
||||||
# Confirm exit method
|
# Confirm exit method
|
||||||
def confirm_exit(self):
|
def confirm_exit(self):
|
||||||
self.destroy() # Closes the ToplevelWindow
|
self.destroy() # Closes the ToplevelWindow
|
||||||
self.callback()
|
self.callback()
|
||||||
|
|
||||||
def align(self):
|
def align(self):
|
||||||
self.label.place(
|
self.label.place(
|
||||||
relx=0.5,
|
relx=0.5,
|
||||||
rely=0.4,
|
rely=0.4,
|
||||||
anchor="center",
|
anchor="center",
|
||||||
)
|
)
|
||||||
self.exit_button.place(
|
self.exit_button.place(
|
||||||
relx=0.25,
|
relx=0.25,
|
||||||
rely=0.6,
|
rely=0.6,
|
||||||
anchor="center",
|
anchor="center",
|
||||||
)
|
)
|
||||||
self.leave_button.place(
|
self.leave_button.place(
|
||||||
relx=0.75,
|
relx=0.75,
|
||||||
rely=0.6,
|
rely=0.6,
|
||||||
anchor="center",
|
anchor="center",
|
||||||
)
|
)
|
Loading…
Reference in New Issue