title: Python3, Understanding the "GUI loop" as in tkinter-mainloop() or QtPy-exec_()
body: <p>3 sub questions: <br>
  [1] python GUIs are polling based? <br>
  it seems to me that both tk and qtpy are polling based, if the gui calls a function that takes a while to excecute, the entire gui hangs. <br>
  I learnt about gui long time ago, I remembered that modern gui should be interrupt based, even when gui were executing something big, gui should be responsive all the time. gui may not display the result from those big calculations, but it will respond to resize, show button click animation etc. So my question is, Is there an option like: <br></p>
  
  <pre><code>    #psuedo code
      root=tkinter.Tk()
      root.setInterruptMode(True)
  </code></pre>
  
  <p>[2] Is tk.mainloop() just a gigantic loop? <br>
  if my first question is a pipe dream, and I will just have to learn about threading and multiprocess, then my next question is about <code>root.mainloop()</code> (or qtpy's <code>exec_()</code>). <br>
  My impression is that mainloop() doesn't really start a thread or anything in python, it just packs a gigantic and invisible tkinter's gui polling+painting loop into my main line. Is my impression correct?</p>
  
  <p>[3] why putting mainloop in Main line? <br>
  Does <code>mainloop()</code> have to reside in the Main line? can I thread/multiprocess it out? so that my Main line can concentrate on big calculations, and the Main line governs gui process and IO processes. All the examples I came across have <code>mainloop()</code> in the Main line, I am not sure it is a recommended approach or what the benefits are.</p>
  
  <p>Below is the code I wrote while trying to learn about python gui:</p>
  
  <pre><code>    import tkinter
      import random
  
      class myGUI():
          def __init__(self, arg_tkroot):
              self.GUI_display = tkinter.Label(arg_tkroot, text='init-ed')
              self.GUI_button = tkinter.Button(arg_tkroot, text='click')
              self.GUI_display.pack()
              self.GUI_button.pack()
  
              self.GUI_button.bind('&lt;Button-1&gt;', self.handle_user_interaction)
              self.list_bigData = []
  
          #handles GUI interaction, and call bigData_and_bigCalculation()
          def handle_user_interaction(self, arg_event):
              print(arg_event, ' detected by myGUI')
              strResult_toFeedbackToUser = self.bigData_and_bigCalculation()
              self.GUI_display.config(text=strResult_toFeedbackToUser)
              print('finished handling user interact')
  
          # slow calculations and memory consuming operations
          def bigData_and_bigCalculation(self):
              self.list_bigData[:]=[]
              for i in range(500000):
                  self.list_bigData.append( ''.join(random.choice('asdfas') for k in range(10)) )
              return self.list_bigData[-1]
      # Main()
      if __name__ == '__main__':
          root = tkinter.Tk()
          mygui = myGUI(root)
          root.mainloop()
  </code></pre>