Al momento de cargar una nueva url mediante el metodo Load() de QtWebkit me arroja este error:
Cita:
les dejo mi codigo (reducido) para que me pueda ayudar a resolver este problema, de ante mano muchas gracias.QObject: Cannot create children for a parent that is in a different thread.
Código:
#!/usr/bin/env python from PyQt4 import QtCore, QtGui, uic from time import sleep import threading import os import sys local_dir = os.path.dirname(os.path.abspath(__file__)) form_class = uic.loadUiType(os.path.join(local_dir, 'gui.ui'))[0] indice = -1 class Main(QtGui.QMainWindow, form_class): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setupUi(self) def carga_banner(url): global window window.banner.load(QtCore.QUrl(url)) def carga_data(): global indice indice += 1 if indice > 2: indice = 0 paginas = ['http://127.0.0.1/banner.html','http://127.0.0.1/banner1.html','http://127.0.0.1/banner2.html'] carga_banner(paginas[indice]) sleep(5) carga_data() app = QtGui.QApplication(sys.argv) window = Main(None) window.show() thread_data = threading.Thread(target=carga_data) thread_data.setDaemon(True) thread_data.start() sys.exit(app.exec_())