Created
May 27, 2020 20:18
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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