title: IPython iterate main loop manually?
body: <p>Can i somehow instance ipython (or even better, ipython-qtconsole) and step trough its's (IPython's) main loop manually?</p>
  
  <p>I want to edit panda3d programs on the fly.</p>
  
  <p>EDIT1:
  Here is code sample which should clarify a bit what i want to do.</p>
  
  <pre><code>import sys
  
  from PyQt4.QtCore import *
  from PyQt4.QtGui import *
  from direct.showbase.ShowBase import ShowBase
  
  class MyApp(ShowBase):
  
      def __init__(self):
          ShowBase.__init__(self)
          self.qtApp = QApplication(sys.argv)
          label = QLabel("Hello World")
          label.show()
          self.m = loader.loadModel("frowney")
          self.m.reparentTo(render)
  
          while 1:
              self.qtApp.processEvents()  #manual step trough Qt loop
              taskMgr.step()              #manual step trough Panda3D loop
  
  app = MyApp()
  </code></pre>
  
  <p>So you can see how i can manually step trough panda and qt, i want to do same with ipython if its possible.</p>
  
  <p><strong>ANSWER</strong>
  Complete file:</p>
  
  <pre><code>from direct.showbase.ShowBase import ShowBase
  from IPython.lib import inputhook
  class MyApp(ShowBase):
  
  def __init__(self):
      ShowBase.__init__(self)
      self.m = loader.loadModel("frowney")
      self.m.reparentTo(render)
  
  def stepMe(self):
      taskMgr.step()              #manual step trough Panda3D loop
      return 0  
  if __name__ == "__main__":  
      app = MyApp()  
      inputhook.set_inputhook(app.stepMe)
  </code></pre>
  
  <p>In your cmd line, just go to directory where file is and do</p>
  
  <ol>
  <li><code>ipython</code></li>
  <li><code>run file.py</code></li>
  <li><code>app.m.setPos(1,1,1)</code></li>
  </ol>