-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gui.py
33 lines (25 loc) · 982 Bytes
/
Gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import tkinter
class GUI:
def __init__(self):
pass
def show_custom_popup(self, titel: str, message: str) -> None:
"""
Displays a custom popup window with the given title and message.
Arguments
---------
title (str): The title of the popup window.
message (str): The message to be displayed in the popup window.
"""
popup = tkinter.Tk()
popup.title(titel)
popup.eval('tk::PlaceWindow . center')
text_length = len(message)
width = min(400, 20 * text_length)
height = min(200, 30 * (text_length // 50 + 1)) + 100
popup.geometry(f"{width}x{height}")
label = tkinter.Label(popup, text=message, padx=20, pady=20, wraplength=350, justify='left')
label.pack()
ok_button = tkinter.Button(popup, text="OK", command=popup.destroy, width=20)
ok_button.pack(pady=10)
popup.focus_force()
popup.mainloop()