8 is_root_window: bool =
True) -> Tuple[int, int, int, int]:
14 root_width, root_height = root.winfo_screenwidth(), root.winfo_screenheight()
15 return width, height, int(root_width / 2 - width / 2), int(root_height / 2 - height / 2)
17 base_width = root.winfo_width()
18 base_height = root.winfo_height()
20 height_coord = root.winfo_rooty() + (base_height - height) / 2 - 20
21 width_coord = root.winfo_rootx() + (base_width - width) / 2
22 logging.debug(f
"Coordinates: width={width}, height={height},"
23 f
"x={int(width_coord)}, y={int(height_coord)}")
24 return width, height, int(width_coord), int(height_coord)
27def puts_text(window: tkinter.Tk, width, height: int, pb_main: tkinter.ttk.Progressbar) ->
None:
29 msg_gay = tkinter.Label(window, text=
"You are genius", font=(
"Segoe UI Light", 30))
33 button_ok = tkinter.Button(window, text=
"Ok", command=window.destroy, bd=2.3)
34 button_ok.place(height=30, width=65, x=width / 2 - 65 / 2, y=height - 40)
38def main(width, height: int) ->
None:
42 window.title(
"Important Message")
45 pb_main = tkinter.ttk.Progressbar(window, orient=tkinter.HORIZONTAL,
46 length=200, maximum=1000, mode=
'indeterminate')
48 pb_main.place(height=30, x=50, y=20)
52 window.after(3000, puts_text, window, width, height, pb_main)
58 window.update_idletasks()
Tuple[int, int, int, int] centre_coordinate(tkinter.Tk root, int width, int height, bool is_root_window=True)