How to limit number of Toplevel windows in tkinter
<p>I have a bit of code that creates a a top level window upon the user
pressing a button. </p>

<p>However i would like to limit the number Top level windows to one, so the user couldn't Spam the button and open fifty windows.</p>

<pre><code>import tkinter as tk

class app():

    def __init__(self,master):

        self.master = master    
        master.configure(background = '#002e3d')
        master.title('Test!')
        master.geometry = master.geometry('660x550+200+200')
        master.resizable(width = False,height = False)
        self.button = tk.Button(master,text = 'Test'command = self.searchmenu)
        self.button.pack()

    def searchmenu(self):
        Demo()


class Demo():

    def __init__(self):
        self.top = tk.Toplevel()
        self.top.title('Search!')


def main():

    root = tk.Tk()
    window = app(root)
    root.mainloop()
</code></pre>