07-04-2009, 04:08 PM
|
#1 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
Python to PHP Translation Needed
Ok I have this python code and I need it translated to PHP super fast before my mother in law dies...
Code:
#!/usr/bin/env python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
class Application(QObject):
def __init__(self):
QObject.__init__(self)
self.setObjectName('Application')
class Console(QObject):
def __init__(self):
QObject.__init__(self)
self.setObjectName('Console')
@pyqtSignature('QString')
def display(self,text):
print text
@pyqtSignature("")
def fortune(self):
print "fortune called"
return 23 # XXX: does not work
if __name__ == '__main__':
app = QApplication(sys.argv)
web = QWebView()
web.setWindowTitle('My Application')
web.resize(800,600)
web.setHtml(QString("<a href=\"#\" onclick=\"Console.display('wow!')\">Hello, World!</a>"))
frame = web.page().mainFrame()
frame.addToJavaScriptWindowObject('Applicaiton',Application())
frame.addToJavaScriptWindowObject('Console',Application.Console())
web.show()
sys.exit(app.exec_())
Now get going this is a life and death situation!!!
|
|
|
|