title: What is the problem of the sidebar and how to fix it?
body: <p>Im trying to make sidebar with  and  binding and if i move my mouse slower everything works fine, but if i go faster with my mouse the sidebar starts to move back and forth without stopping. Is there a way to fix it?</p>
  <p>(Im new with tkinter and python in general)
  <a href="https://i.stack.imgur.com/5lZWL.png" rel="nofollow noreferrer">1/2</a>
  <a href="https://i.stack.imgur.com/gwky7.png" rel="nofollow noreferrer">2/2</a></p>
  <pre><code>from tkinter import *
  </code></pre>
  <p>#MainWindow
  def MainWindow():
  global WindowMain</p>
  <pre><code>    WindowMain = Tk()
      WindowMain.config(background=&quot;LightGray&quot;)
      WindowMain.overrideredirect(1)
  
  
  #MainWindow_size
  def Screen_size():
      app_width = 1280
      app_height = 720
  
      screen_width = WindowMain.winfo_screenwidth()
      screen_height = WindowMain.winfo_screenheight()
  
      x = (screen_width / 2) - (app_width / 2)
      y = (screen_height / 2) - (app_height / 2)
      WindowMain.geometry(f'{app_width}x{app_height}+{int(x)}+{int(y)}')
  
  #Func1
  def close(e):
      for x in range(1000, 1200):
          Blue.place(x=x, y=0)
          DarkBlue.place(x=x, y=0)
          Blue.update()
          DarkBlue.update()
          Blue.bind(&quot;&lt;Enter&gt;&quot;, open)
  
  #Func2
  def open(e):
      for x in range(-1200, -1000):
          Blue.place(x=-x, y=0)
          DarkBlue.place(x=-x, y=0)
          Blue.update()
          DarkBlue.update()
          Blue.bind(&quot;&lt;Leave&gt;&quot;, close)
  
  
  MainWindow()
  Screen_size()
  
  #Label1&amp;2
  Blue = Label(WindowMain, background=&quot;DeepSkyBlue&quot;,
               width=70, height=50)
  DarkBlue = Label(WindowMain, width=2, height=100,
                   background=&quot;DodgerBlue&quot;)
  
  Blue.place(x=1200)
  DarkBlue.place(x=1200)
  
  #Buttons
  Quit = Button(WindowMain, text=&quot;Quit&quot;, command=quit,
                background=&quot;LightSkyBlue&quot;).pack()
  
  Move = Button(WindowMain, text=&quot;open&quot;, command=open,
                background=&quot;LightSkyBlue&quot;, state=DISABLED).pack()
  Undo = Button(WindowMain, text=&quot;close&quot;, command=close,
                background=&quot;LightSkyBlue&quot;, state=DISABLED).pack()
  
  
  Blue.bind(&quot;&lt;Enter&gt;&quot;, open)
  
  
  WindowMain.mainloop()
  </code></pre>