'When I open new window with button click, also another mini window pops up

I want to open new window with button click and close the old one. I tried to do that with this code, but when I click button it's also open another mini window with title 'tk'. How can I prevent that?

from tkinter import *
from PIL import Image, ImageTk


def openOperationsGui():
    window.destroy()
    operationsWindow = Toplevel()
    operationsWindow.title("Operations")
    operationsWindow.geometry("1366x768")

window = Tk()


logo = Image.open("resources\logo.png")
logoImg = ImageTk.PhotoImage(logo)

logoLbl = Label(image=logoImg)
logoLbl.place(x=450, y=120, height=500, width=500)      

conn = Button(window, text="Connect", fg='blue', command=openOperationsGui)
conn.place(x=450, y=533, height=87, width=490)



passw = Entry(window, text="", bd=5)
passw.place(x=620, y=480, height=50, width=150)



window.title('Title')

window.geometry("1366x768")

window.mainloop()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source