Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved QWidget is not updating it's GUI

    General and Desktop
    2
    2
    894
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SirMeMeME last edited by

      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):
      		super().__init__()
      		uic.loadUi('Test.ui', self)
      		self.counter.intValue = 20
      		self.counter.update()
      		print("I have... " + str(self.counter.intValue))
      
      if __name__ == '__main__':
      	app = QApplication(sys.argv)
      
      	mApp = MyApp()
      	mApp.show()
      
      	sys.exit(app.exec_())
      

      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

      JonB 1 Reply Last reply Reply Quote 1
      • JonB
        JonB @SirMeMeME last edited by JonB

        @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.

        1 Reply Last reply Reply Quote 3
        • First post
          Last post