Duplicate?
https://groups.google.com/d/topic/python_inside_maya/p9Aca1R-oag/discussion


On Monday, December 3, 2012 10:59:23 PM UTC-8, Patinjarayil Sudeepth wrote:
>
> Hi All,
>  
> I an having a problem in the key press event. My key press event code is 
> as follows
>  
> def keyPressEvent(self, 
> event):                                                                       
>                                                                  
>         keyPossiblities = ['0','1','2','3','4','5','6','7','8','9'] # 
> Keyboard NUM 
> Keys                                                                          
>         if type(event) == 
> QtGui.QKeyEvent:                                                              
>                                                              
>
>             if self.findChildren(QtGui.QTabWidget,"TAB_CScomment") 
> :                                                                             
>       
>                 if event.key() < 255 
> :                                                                             
>                                                           
>  
>                     if chr(event.key())in keyPossiblities 
> :                                                                             
>                                 
>                         prvTxt = self.textFLD 
> [str(self.clickedFileName)].toPlainText()                                     
>                                  
>
>                         self.textFLD 
> [str(self.clickedFileName)].setHtml("%s %s" % (prvTxt, 
> self.preDefComments[chr(event.key())])) 
>                     
> event.accept()                                                                
>                                                                              
>         
> else:                                                                         
>                                                                               
>                
>             
> event.ignore()                                                                
>                                                                               
>         
>  
> It actually fills a QTextEdit with the text from the text file when the 
> user press NUM key digits (0-9). Everything is working is expected. But 
> if the QTextEdit is on focus key press event is not working. can anyone 
> help me.
>  
> Thanks and Regards,
> Sudeepth Patinjarayil.
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to