Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6338013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:21:41+00:00 2026-05-24T19:21:41+00:00

Can i somehow instance ipython (or even better, ipython-qtconsole) and step trough its’s (IPython’s)

  • 0

Can i somehow instance ipython (or even better, ipython-qtconsole) and step trough its’s (IPython’s) main loop manually?

I want to edit panda3d programs on the fly.

EDIT1:
Here is code sample which should clarify a bit what i want to do.

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()

So you can see how i can manually step trough panda and qt, i want to do same with ipython if its possible.

ANSWER
Complete file:

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)

In your cmd line, just go to directory where file is and do

  1. ipython
  2. run file.py
  3. app.m.setPos(1,1,1)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:21:42+00:00Added an answer on May 24, 2026 at 7:21 pm

    By “edit panda3d programs on the fly”, do you just mean changing things in order to test your running program? Or actually making persistent edits to your program’s structure in the interactive environment?

    Simply stepping over your loop in an interactive python session is quite easy. You can just replace while 1: with a method declaration such as def step(self):, then call it for each step.

    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)
    
        def step(self):
            self.qtApp.processEvents()  #manual step trough Qt loop
            taskMgr.step()              #manual step trough Panda3D loop
            return 0                    #PyOS_InputHook expects an integer
    
    if __name__ == "__main__":
        app = MyApp()
        while 1: app.step()
    

    With if __name__ == "__main__" for the main loop, your file will still work as it should when run standalone. But now you can import it into an interactive session and modify things in between steps.

    >>> import myfile
    >>> app = myfile.MyApp()
    >>> app.step()
    >>> app.something = something_else
    >>> app.step()
    

    Now to add it to IPython’s event loop, so it will be run as you use the interpreter, you can use IPython.lib.inputhook.set_inputhook() (new in IPython 0.11).

    >>> from IPython.lib import inputhook
    >>> inputhook.set_inputhook(app.step)
    

    This should cause your program to run while the interpreter is idle, but still allow manipulation as usual.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can i somehow compare two numbers in regex? i want regex that is correct
Can I somehow get a reference to the instance I am creating using object
Firebug, from what I can tell, uses one element to display its console. Somehow,
So my question is if I can somehow send data to my program and
Can I somehow disable spell-checking on HTML textfields (as seen in e.g. Safari)?
Can I somehow disable ListView items navigation through keyboard (arrow keys), and leave navigation
I've been working all day and I somehow can't get this probably easy task
looper = (0..3).cycle 20.times { puts looper.next } can I somehow find the next
This sure seems like a simple error to fix. However, I somehow can't figure
Can I get somehow(from a database or other source) a percentage of the phones

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.