Skip to content

Instantly share code, notes, and snippets.

@messa
Created August 5, 2010 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save messa/509640 to your computer and use it in GitHub Desktop.
Save messa/509640 to your computer and use it in GitHub Desktop.
I just wanted to test and show something about processEvents
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
from PyQt4 import QtGui, QtCore
app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('Hello, World!')
te = QtGui.QTextEdit(widget)
def append():
i = 0
while True:
te.append(" %d" % i)
i += 1
time.sleep(0.5)
app.processEvents() # <<<
btn = QtGui.QPushButton("Append", widget)
widget.connect(btn, QtCore.SIGNAL('clicked()'),
append)
widget.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment