On Thursday 25 August 2011, 12:02:52 uahmed wrote: > Hi > > I want to update the Qlabel after the widget is made , Problem is > that updating is base on counter so i call that function after 4 > seconds , but when it by pass the "if" statment it go through all the > commands give me no errors but it does not update the widet although > if i dont putt "if" statment all lines are executed and Qlabel update > too . Can you please tell me where i am wrong > > Here is code > > import sys,os > from functools import partial > from PyQt4 import QtGui, QtCore > import time > > > class main(): > > def f2(self): > print "f2" > global count > count +=1 > if ( count == 2): > msg_label["user"] = > QtGui.QLabel("update",widget) msg_label["user"].setGeometry(10, 10, > 100, 100) print count > QtCore.QTimer.singleShot(4000, self.f2) > > > app = QtGui.QApplication(sys.argv) > widget = QtGui.QWidget() > layout = QtGui.QVBoxLayout() > buttons = {} > count = 0 > msg_label = {} > sk = main() > sk.f2() > widget.show() > sys.exit(app.exec_())
Don't recreate the widget over and over again. Create it once, and just change the label with setText(). Pete _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt