PySide2 not updating QLabel text when asked

后端 未结 2 1925
南方客
南方客 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.

提交回复
热议问题