Python/pyqt5/CODE/qt05x範例程式/qt05_timer02.py
2024-06-27 15:41:10 +08:00

25 lines
535 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
'''
【簡介】
PyQT5中QTimer關閉程式範例
'''
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
if __name__ == '__main__':
app = QApplication(sys.argv)
label = QLabel("<font color=red size=128><b>Hello PyQt視窗會在10秒後消失</b></font>")
# 無邊框視窗
label.setWindowFlags(Qt.SplashScreen|Qt.FramelessWindowHint)
label.show()
# 設定10秒後自動退出
QTimer.singleShot(10000, app.quit)
sys.exit(app.exec_())