Eric6中PyQt5自動生成代碼

PYcharm比較好用,但沒有Eric6中自動生成代碼的功能,記錄下方便粘貼app

# -*- coding: utf-8 -*-ui

"""
Module implementing MainWindow.
"""spa

from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QMainWindow
from Ui_untitled import Ui_MainWindow
from PyQt5 import QtWidgets.net

class MainWindow(QMainWindow, Ui_MainWindow):
    """
    Class documentation goes here.
    """
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget
        @type QWidget
        """
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
    
    @pyqtSlot()
    def on_pushButton_clicked(self):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        raise NotImplementedError
        
if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    ui = MainWindow()
    ui.show()
    sys.exit(app.exec_())事件

本體窗口運行utf-8

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())get

 

# qt的信號槽機制,鏈接按鈕的點擊事件和相應的方法
#self.pussButton_signin.clicked.connect(lambda: self.sign_in())
#self.pussButton_signup.clicked.connect(lambda: self.sign_up())
相關文章
相關標籤/搜索