[PyQt] QStyleOptionButton.text cannot be updated once accessed

Phil Thompson phil at riverbankcomputing.com
Thu Sep 29 15:46:11 BST 2016


On 29 Sep 2016, at 10:39 am, Ales Erjavec <ales.erjavec324 at gmail.com> wrote:
> 
> QStyleOptionButton.text attribute cannot be updated it it was
> previously assigned to or just accessed
> 
> The following fails with an assertion error:
> 
> ======
> 
> from PyQt5.QtWidgets import QStyleOptionButton
> opt = QStyleOptionButton()
> opt.text = "Hello"
> assert opt.text == "Hello"  # This works,
> 
> opt.text = "world!"
> assert opt.text == "world!" # This fails, opt.text is still "Hello"
> 
> 
> opt = QStyleOptionButton()
> print(opt.text)  # access
> opt.text = "Hello"
> assert opt.text == "Hello"  # This fails, opt.text is still ''
> 
> ======
> 
> Python: 3.5
> PyQt: 5.7  (installed from the official wheel)
> OS: OS X 10.11.6 El Capitan

Should be fixed with tonight's SIP snapshot.

Thanks,
Phil


More information about the PyQt mailing list