title: How can I check whether a tkinter window exists?
body: <p>I have written this code in python 2.7. here i have created a button named message. whenever i click on this button, a new window is created. Now i want to check a condition that if new window (which appears after clicking the button) exist, show a pop-up that a window of same type exist. and if there is no window of same type, new window should be created.</p>
  
  <pre><code>from Tkinter import *
  
  def message():
      m_root = Tk()
  
      entry_value = StringVar()
  
      m_label = Label(m_root, text="message")
      m_label.pack()
  
      frame1 = Frame(m_root)
      frame1.pack()
      frame2 = Frame(m_root)
      frame2.pack()
  
      entry_box = Entry(frame1, width=30, bd=5)
      entry_box.pack()
  
      button1 = Button(frame2, text="Comment")
      button1.pack(side="left")
  
      m_root.mainloop()
  
  root = Tk()
  
  root.geometry('150x30+1+1')
  root.wm_attributes("-topmost", True)
  
  comment_button = Button(root, text="Comment", command = message, bg="gray", width=10)
  comment_button.pack(anchor=CENTER)
  
  root.mainloop()
  </code></pre>