Qt World Summit: Submit your Presentation

QWidget is not updating it's GUI

  • I made my own widget form but it's not updating it's gui. Here is the code I am using:

    import sys
    from PyQt5.QtWidgets import QApplication, QWidget
    from PyQt5 import uic
    class MyApp(QWidget):
    	def __init__(self):
    		uic.loadUi('Test.ui', self)
    		self.counter.intValue = 20
    		print("I have... " + str(self.counter.intValue))
    if __name__ == '__main__':
    	app = QApplication(sys.argv)
    	mApp = MyApp()

    self.counter is a LCD Number Counter thing. It doesn't update and the same happens for when I am trying to update a progress bar. It does print that it is set to 20 in the console though

  • @SirMeMeME said in QWidget is not updating it's GUI:

    self.counter.intValue = 20

    QLCDNumber::intValue is get-only. Your Python/PyQt5 perhaps does not warn you that you cannot set it like you try to in your code. Use void QLCDNumber::display(int num) to set the value: self.counter.display(20). There should be no need for your self.counter.update() call.

    Don't know what call you are using to update your progressbar.

Log in to reply