This is my code, how can I make the opened window to close automatically after 10s? I tried with the time.sleep(10) and then win.close() but it doesn't do anything.
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
def window():
app = QApplication(sys.argv)
win = QMainWindow()
win.setGeometry(200,200,300,300)
win.setWindowTitle("test")
label = QtWidgets.QLabel(win)
label.setText("test")
label.move(50,50)
win.show()
sys.exit(app.exec_())
window()