[PyQt] QPushButton.text() ampersand issue

Samuele Carcagno sam.carcagno at gmail.com
Fri Oct 9 18:42:47 BST 2015


Hi all,

I'm having an issue getting the text from a QPushButton.The text of the 
button is set with:

     statusButton = QPushButton(translator.translate('rb', "Start"), self)

the text appears normally on the button (i.e. without an ampersand), but 
when I get the text with:

     status = statusButton.text()

the string returned is "&Start" instead of "Start". Translated strings 
are also returned with an ampersand (e.g. "&Inizia" instead of 
"Inizia"). This issue is occurring with PyQt 5.4.1 on Kubuntu Vivid, and 
with PyQt 5.4.2 on Debian testing, but not on Debian Jessie with PyQt 5.3.2.


Thanks for your help.

Sam


More information about the PyQt mailing list