Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidget is not updating it's GUI
Forum Updated to NodeBB v4.3 + New Features

QWidget is not updating it's GUI

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.7k Views
  • 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 Offline
    S Offline
    SirMeMeME
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    1
    • S SirMeMeME

      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

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

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

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved