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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -