title: Python & tkinter: input names and then select one at random
body: <p>I have just started to learn how to program with Python from tutorials etc from the internet. I am currently trying to build a program where a user can input several names into an entry box and then one of the names then be selected at random.</p>
  
  <p>I managed to do this using command line but am struggling to get it to work when building it as a GUI. For my command line code I used:</p>
  
  <pre><code>import random
  import time
  
  print ("Hello!")
  
  userInput = input ('Please enter the names:')
  time.sleep (5) 
  
  userInput = str(userInput).split () 
  
  name = random.choice (userInput)
  
  print ("Its",name)
  </code></pre>
  
  <p>I was wondering how to create the same program but run it in a GUI. The code I have so far is:</p>
  
  <pre><code>import random
  import time
  from tkinter import *
  root = Tk()
  
  
  def input():
      time.sleep (5)
      mytext=userInput.get()
      label2 = Label(root,text=mytext).pack()
  
  userInput = StringVar()
  
  
  root.geometry("500x500") 
  root.title("Tkinter GUI")
  
  
  Label1 = Label(root,text="Welcome to my program").pack() 
  
  entry = Entry(root,textvariable=userInput).pack()
  
  
  
  Button1 = Button(root,text="Go",command=input).pack() 
  
  
  root.mainloop()
  </code></pre>
  
  <p>For my GUI based code I can enter some names etc but im not sure how I can have one selected at random. Can I still use the <code>.split()</code> &amp; <code>random.choice</code> as per my text based code? Where in my GUI code would I need to enter this? I have tried several different places but have been unable to get it to work. I assume this is something which should be fairly easy to do? Any help would be much appreciated.</p>
  
  <p>Thanks</p>