Skip to content

Instantly share code, notes, and snippets.

@8Observer8
Created May 27, 2020 20:18
Show Gist options
  • Save 8Observer8/3a88bb6b664fbcf568367f99b96b637f to your computer and use it in GitHub Desktop.
Save 8Observer8/3a88bb6b664fbcf568367f99b96b637f to your computer and use it in GitHub Desktop.
Port a console app example to PySide2 from the theme: https://stackoverflow.com/questions/10641055
from PySide2 import QtCore
class Console(QtCore.QObject):
def __init__(self, msg):
super(Console, self).__init__()
self.msg = msg
self.timer = QtCore.QBasicTimer()
self.timer.start(500, self)
self.i = 0
def timerEvent(self, event):
print(self.msg)
self.i += 1
if self.i > 5:
QtCore.QCoreApplication.instance().quit()
if __name__ == "__main__":
import sys
app = QtCore.QCoreApplication(sys.argv)
console = Console("Hello, World!")
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment