Skip to content

Instantly share code, notes, and snippets.

@messa
Created Aug 5, 2010
Embed
What would you like to do?
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