PySide2 not updating QLabel text when asked

后端 未结 2 1926
南方客
南方客 2021-01-15 15:17

I am upgrading from Python 2.7 to Python 3.6 and from PySide to PySide2. I started by trying to get the \"Hello World\" from the \"Getting Started\" site (https://doc-snapsh

相关标签:
2条回答
  • 2021-01-15 15:49

    Fixed this problem on my Mac under python3.6 by adjusting the magic function:

    def magic(self):
        self.text.setText(random.choice(self.hello))
        self.repaint()
    

    The self.repaint() is needed for some reason, but at least works.

    0 讨论(0)
  • 2021-01-15 15:59

    If you are running PySide2==5.15.0 then you need to upgrade it to 5.15.1 and thats what solved my problem.

    Command to upgrade PySide2:

    pip/pip3 install --upgrade PySide2
    
    0 讨论(0)
提交回复
热议问题