i am building a desktop application using PyQt python which has a QwebBrowser. now i am running some function using javascript which is returning a value say abc as per following example.
class QWebView(QWebView):
def contextMenuEvent(self,event):
menu = QMenu()
self.actionShowXpath = menu.addAction("Show Xpath")
QObject.connect(self.actionShowXpath,SIGNAL("triggered()"),self,SLOT("slotshowxpath()"))
menu.exec_(self.mapToGlobal(QPoint(event.x(),event.y())))
@pyqtSlot()
def slotshowxpath(self):
frame.evaluateJavaScript("var abc = function get()");
result = frame.evaluateJavaScript("abc").toString()
**some code code to put result in QLineEdit Widget**
# something like below
# xpath.setText(result)
def window():
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
web = QWebView(w)
web.load(QUrl("http://www.indiatimes.com/"))
web.show()
xpath = QtGui.QLineEdit("", w)
sys.exit(app.exec_())
if __name__ == '__main__':
window()
now, i want to put the value of abc in a QLineEdit widget("xpath") present in my application.please give me suggestion that how i can i do this?