title: Mode selection inside Tkinter mainloop()
body: <p>I am having the following problem:
  I want to be able to select a mode while one of the three if statements is running and when is finishes to go to the one that is selected. For excample if 'mode' is running and I select 'p' after the 's' if ends the 'p' if starts. 
  I also want this processes to run unstopably
  Thank you :D</p>
  
  <pre><code>import tkinter as tk
  from tkinter import *
  
  answer = ''
  
  root = Tk()
  root.geometry('250x150')
  root.title('Mode Selection')
  
  v = tk.IntVar()
  v.set(0)  # initializing the choice, i.e. Python
  b1 = Button()
  
  modes = [
      ('s', 'to start"'),
      ('p', 'to pause'),
      ('a', 'to abort'),
  ]
  
  tk.Label(root,
           text="""Choose a mode:""",
           justify=tk.CENTER,
           padx=20).pack()
  
  for val, language in enumerate(modes):
      tk.Radiobutton(root,
                     text=language,
                     padx=20,
                     variable=v,
                     value=val,
                     justify=tk.CENTER).pack()
  
  answer = modes[v.get()][0]
  
  if answer == 's':
      print('s')
      # do something...
  elif answer == 'p':
      print('p')
      # do something...
  elif answer == 'a':
      print('a')
      # do something...
  
  root.mainloop()
  </code></pre>