title: Running Tkinter with interactive ipython notebook
body: <p>I want to create an interactive python coding game, where users can enter commands into a jupyter notebook and see the result on a GUI in real time. This seems to work fine in the regular python interactive shell. The way I get this to run is the following: </p>
  
  <ol>
  <li>I make a file, lets call it <code>example.py</code> with the following code:</li>
  </ol>
  
  <pre><code>import tkinter as tk
  
  
  def create_canvas():
      root = tk.Tk()
      root.resizable(False, False)
      root.title("Karel")
      frame = tk.Frame(root)
      frame.pack()
      canvas = tk.Canvas(frame, bg="white", width=500, 
          height=500)
      canvas.pack()
      return canvas
  
  
  def create_oval(canvas):
      return canvas.create_oval(150, 150, 155, 155, fill='#000')
  
  
  
  def move(canvas, oval):
      canvas.move(oval, 0, -50)
  </code></pre>
  
  <ol start="2">
  <li>Then in the interactive python  shell I do the following:</li>
  </ol>
  
  <pre><code>&gt;&gt; import example
  &gt;&gt; canvas = example.create_canvas()
  &gt;&gt; oval = example.create_oval(canvas)
  </code></pre>
  
  <p>However, when I try to get this working in ipython, I don't see a GUI (I'm assuming this is because I don't execute tkinters <code>mainloop</code> function). But if I do execute the <code>mainloop</code> function, then I can't have the user type in an interactive python shell anymore. </p>
  
  <p>So my question, is how do I get ipython (so I can use jupyter notebooks) to behave like python and display the GUI without blocking user input from the console?</p>
  
  <p>[EDIT]: I figured out how to do it with ipython. 
  I have to type <code>ipython --gui 'tk'</code> but how do I pass ipython options to a jupyter notebook server so that I can do this all in a notebook?</p>