python: PyQt5 beginner

 

from PyQt5.QtWidgets import QWidget,  QApplication, QMainWindow, QLabel, QPushButton
from PyQt5 import QtCore, QtGui
import sys
import os

def click():
    print("Hy Button is clicked!")

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm,Geovin Du,涂聚文')
    #StudentId = 1, StudentName = 'geovindu', StudentNO = '0001', StudentBirthday = datetime.datetime(2007, 12, 5)
    #创建表
    #stu=Mapping.StudentMaping.Student()
    #stu.CreateTable()
    ''''''
    app = QApplication(sys.argv)
    widget = QWidget()
    widget.resize(640, 480)
    widget.setWindowTitle("Hello, PyQt5!")
    # Label Text
    label = QLabel(widget)
    label.resize(300, 100)
    label.setText("Hi this is Pyqt5,涂聚文学习中")
    label.move(100, 100)

    button = QPushButton(widget)
    button.resize(200, 100)
    button.setText("Hi! Click Me")
    button.move(400, 300)
    button.clicked.connect(click)

    widget.show()
    sys.exit(app.exec())

  输出:

 

posted @ 2023-07-07 19:52  ®Geovin Du Dream Park™  阅读(12)  评论(0)    收藏  举报