title: My over redirected window doesn't work normally if I open it from another window
body: <p>I have a python code, which opens an over redirected window, but some things doesn't working normally. If I open it from another window, my dragging function will doesn't work normally, and if I interact with this window, the window's title and icon will appear on the taskbar. I don't know where is the problem, because I hadn't changed the code. (I only putted it to a simple function.).</p>
  <p>Here is the code:</p>
  <pre><code>import time
  from tkinter import *
  from PIL import ImageTk, Image
  
  def cmd():
      
      lastClickX = 0
      lastClickY = 0
  
      def SaveLastClickPos(event):
          global lastClickX, lastClickY
          lastClickX = event.x
          lastClickY = event.y
  
      def Dragging(event):
          deltax = event.x - lastClickX
          deltay = event.y - lastClickY
          x = window.winfo_x() + deltax
          y = window.winfo_y() + deltay
  
          window.geometry(&quot;+%s+%s&quot; % (x, y))
  
      def leave(event):
          CloseButton[&quot;image&quot;] = CloseButtonImg
  
      def enter(event):
          CloseButton[&quot;image&quot;] = CloseButtonImg3
  
      def close():
          for i in range(5):
              time.sleep(0.01)
              window.geometry(&quot;%sx%s&quot; % (window.winfo_height() - 2, window.winfo_width() - 2))
              window.geometry(&quot;+%s+%s&quot; % (window.winfo_x() + 1, window.winfo_y() + 1))
  
              window.attributes(&quot;-alpha&quot;, 0.6)
              window.update()
  
          window.destroy()
  
  
      def opening():
          window.geometry(&quot;390x390&quot;)
          window.update()
  
          time.sleep(0.01)
          window.geometry(&quot;%sx%s&quot; % (window.winfo_height() + 2, window.winfo_width() + 2))
          window.geometry(&quot;+%s+%s&quot; % (window.winfo_x() - 1, window.winfo_y() - 1))
  
          window.attributes(&quot;-alpha&quot;, 0.6)
          window.update()
          time.sleep(0.01)
          window.geometry(&quot;%sx%s&quot; % (window.winfo_height() + 2, window.winfo_width() + 2))
          window.geometry(&quot;+%s+%s&quot; % (window.winfo_x() - 1, window.winfo_y() - 1))
  
          window.attributes(&quot;-alpha&quot;, 0.7)
          window.update()
          time.sleep(0.01)
          window.geometry(&quot;%sx%s&quot; % (window.winfo_height() + 2, window.winfo_width() + 2))
          window.geometry(&quot;+%s+%s&quot; % (window.winfo_x() - 1, window.winfo_y() - 1))
  
          window.attributes(&quot;-alpha&quot;, 0.8)
          window.update()
          time.sleep(0.01)
          window.geometry(&quot;%sx%s&quot; % (window.winfo_height() + 2, window.winfo_width() + 2))
          window.geometry(&quot;+%s+%s&quot; % (window.winfo_x() - 1, window.winfo_y() - 1))
  
          window.attributes(&quot;-alpha&quot;, 0.9)
          window.update()
          time.sleep(0.01)
          window.geometry(&quot;%sx%s&quot; % (window.winfo_height() + 2, window.winfo_width() + 2))
          window.geometry(&quot;+%s+%s&quot; % (window.winfo_x() - 1, window.winfo_y() - 1))
  
          window.attributes(&quot;-alpha&quot;, 1)
          window.update()
  
  
  
      window = Toplevel()
      window.overrideredirect(True)
  
      Fram = Frame(window, height=30, width=400, bg=&quot;white&quot;)
      Fram.place(y=0, x=0)
      Label(Fram, text=&quot;Window&quot;, font=&quot;Arial 10&quot;, bg=&quot;white&quot;, fg=&quot;black&quot;).place(y=2, x=2)
      window.attributes('-topmost', True)
      window.geometry(&quot;400x400+500+300&quot;)
      window.bind('&lt;Button-1&gt;', SaveLastClickPos)
      CloseButtonImg = ImageTk.PhotoImage(Image.open(&quot;Images\\Close1.png&quot;))
  
      CloseButtonImg3 = ImageTk.PhotoImage(Image.open(&quot;Images\\Close3.png&quot;))
      CloseButton = Button(window, image=CloseButtonImg, bg=&quot;white&quot;, borderwidth=0, activebackground=&quot;white&quot;,
                           relief=SUNKEN, command=close)
      CloseButton.place(y=-2, x=370)
      CloseButton.bind(&quot;&lt;Enter&gt;&quot;, enter)
      CloseButton.bind(&quot;&lt;Leave&gt;&quot;, leave)
      Fram.bind('&lt;B1-Motion&gt;', Dragging)
  
      window.after(1, func=opening)
      window.mainloop()
  
  
  k = Tk()
  Button(k, text=&quot;Haha&quot;, command=cmd).pack()
  k.mainloop()
  </code></pre>