api.py
import web
import threading
urls = (
'/', 'index',
)
class index:
def GET(self):
return "I'm lumberjack and i'm ok"
def run():
app = web.application(urls, globals())
t = threading.Thread(target=app.run)
t.setDaemon(True) # So the server dies with the main thread
t.setName('api-thread')
t.start()
frame.py
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import api
app = QApplication(sys.argv)
web = QWebView()
api.run()
web.load(QUrl("http://0.0.0.0:8080/"))
web.show()
sys.exit(app.exec_())