See QT Documentation for installing PySide2.
Created
May 5, 2018 08:34
-
-
Save Holi0317/cacd4c58643151142992a76ebccf5bc8 to your computer and use it in GitHub Desktop.
Demo of popup windows using PySide2
This file contains 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
""" | |
Popup windows for PySide2 | |
""" | |
import sys | |
import threading | |
import time | |
from PySide2.QtCore import QThread | |
from PySide2.QtWidgets import QApplication, QMessageBox | |
class Sleeper(QThread): | |
def run(self): | |
time.sleep(2) | |
msg = make_message() | |
msg.show() | |
time.sleep(4) | |
msg.hide() | |
def make_message(): | |
msg = QMessageBox() | |
msg.setIcon(QMessageBox.Warning) | |
msg.setText("Here is example text") | |
msg.setInformativeText("Informative text here!") | |
msg.setStandardButtons(QMessageBox.Ok) | |
return msg | |
class App(QApplication): | |
def __init__(self): | |
QApplication.__init__(self, []) | |
self.t = Sleeper() | |
self.t.start() | |
def main(): | |
"""Entry of the script.""" | |
app = App() | |
sys.exit(app.exec_()) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not work for me.