title: Tkinter button does not appear, sorry guys I know that a thread already exists
body: <p>The button it does not appear , any tips guys?. The screenshot func works fine but not the button, I <strong>have</strong> to close it on my own.</p>
  <pre><code>import time
  from tkinter import *
  import pyautogui
  
  class App:
  
      def __init__(self, master, task):
  
          frame = Frame(master)
          frame.pack()
  
          self.button = Button(
              frame, text=&quot;QUIT&quot;, fg=&quot;red&quot;, command=frame.quit
              )
          self.button.pack(side=LEFT)
          frame.after(0,task)
  
  def task():
      i = 1
      while i &gt; 0:
          myScreenshot = pyautogui.screenshot()
          myScreenshot.save(r&quot;C:\Users\elsin\Desktop\python\nameTask&quot; + str(i) + &quot;.png&quot;)
          time.sleep(2)
          i += 1
  
  root = Tk()
  
  app = App(root,task())
  root.mainloop()
  </code></pre>
  <p>Error:</p>
  <pre><code>C:\Users\elsin\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/elsin/PycharmProjects/pythonProject/1.py
  Traceback (most recent call last):
    File &quot;C:\Users\elsin\PycharmProjects\pythonProject\1.py&quot;, line 28, in &lt;module&gt;
      app = App(root,task())
    File &quot;C:\Users\elsin\PycharmProjects\pythonProject\1.py&quot;, line 23, in task
      time.sleep(2)
  KeyboardInterrupt
  
  Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)
  </code></pre>