I am in my first steps in PyQt and I face difficulties in how to run the following code within QGIS console. I want to create a simple window, but nothing happens. I change main by console and then QGIS crashes. Any help is welcome.
import sys
from PyQt5.QtWidgets import QApplication, QWidget
def main():
app = QApplication(sys.argv)
w = QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()