Menu

Non-blocking PythonQt

Help
nibbit
2013-07-24
2013-07-25
  • nibbit

    nibbit - 2013-07-24

    Hello,

    I implemented something similar to script console example in my application. I have GUI app with script editor. The problem is that the running script is blocking my GUI app (for ex. time.sleep(x))and I need scripts working in background necessarily.

    I was trying to move all PythonQt code (includint PythonQt::init)from Main Thread to new Python thread (exactly to run method) but sth is wrong. Especially with:
    console = new PythonQtScriptingConsole(NULL, mainContext);
    I got error when starting thread:
    QObject::setParent: Cannot set parent, new parent is in a different thread

    So, PythonQt can work only from Main Thread? I am new in Qt and I don't know how to make this code work in backgroung.

    Best regards

     
  • nibbit

    nibbit - 2013-07-25

    Hello,
    Scripts works ok in QThread, but I can not use console from QThread only. That is no problem, I redirect StdOut and StdErr.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.