javascript - Passing key press event from HTML element to python? -


i have html page displayed qwebview control in pyqt. html page consists of 'input' element given below

    <html>      <body>       <input id="username"></input>      </body>     <html> 

the code snippet of python part display above html given below

    view = qwebview()     view.load('myview.html')     view.show() 

i handling key events of qwebview in python part below

    def keypressevent(self, event):         print event.key() 

this works fine; , can see key fired in qwebview. once click in input element , try edit few values, keys not getting in keypressevent. internally handled in html element think. want pass key events python part simultaneously; thinking of little bit hacking kind of work accomplish this.

any solution appreciated.

thanks in advance

i'd try using qwebview @ qwebelement receive html input.

documentelement = view.page().currentframe().documentelement() input = documentelement.findfirst('input[id="username"]') 

now have hold of input read after keypressevent or maybe connect direct qwebelement (this may not possible).

you can recover text

 print unicode(input.toouterxml()) 

Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

sql server - SQL Query returns one result, does not return 0 or NULL result -