Использую заставку для основного окна в приложении написаного на основе tkinter на пайтоне. Как не нстроивал окно заставки, не могу добиться идеала. Задача чтобы окно затавки повторяло основное окно по размеру и чтобы оба появлялись в центре екрана.
Основное окно:
root = Tk()
root.title('Covid-19 Magic8Ball')
root.resizable(False, False)
canvas = Canvas(root, height= 500, width= 610)
canvas.pack()
Окно заставки:
splash_root = Tk()
splash_root.title("opa")
splash_root.geometry("500x500")
windowWidth = splash_root.winfo_reqwidth()
windowHeight = splash_root.winfo_reqheight()
print("Width",windowWidth,"Height",windowHeight)
# Gets both half the screen width/height and window width/height
positionRight = int(splash_root.winfo_screenwidth()/2 - windowWidth/2)
positionDown = int(splash_root.winfo_screenheight()/2 - windowHeight/2)
# Positions the window in the center of the page.
splash_root.geometry("+{}+{}".format(positionRight, positionDown))
splas_label = Label(splash_root, text = "Slash")
splas_label.pack(pady=20)