There is a script that by clicking on the button creates a new window. How can I make it so that a new window is not created by pressing a button if this window is already open? Here is the code:
#-*- coding: utf-8 -*- from tkinter import * root = Tk() root.geometry('700x700') root.title('Root') def new_window(event): window = Toplevel(root) lab = Label(root, text='Press here') but = Button(root, text='Ok') but.bind('<Button->', new_window) lab.pack() but.pack() root.mainloop()