|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
##主程序
import sys
import sign_in_window
from PyQt5.QtWidgets import QApplication,QMainWindow
if __name__ == '__main__':
app=QApplication(sys.argv)
mainwindow=QMainWindow()
ui=sign_in_window.Ui_sign_in_window()
ui.setupUi(mainwindow)
mainwindow.show()
sys.exit(app.exec_())
!!!!!!为什么会出现这个错误啊,类名没错啊AttributeError: module 'sign_in_window' has no attribute 'Ui_sign_in_window'
##ui转成的py文件
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'sign_in_window.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_sign_in_window(object):
def setupUi(self, sign_in_window):
sign_in_window.setObjectName("sign_in_window")
sign_in_window.resize(624, 265)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(sign_in_window)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.graphicsView_2 = QtWidgets.QGraphicsView(sign_in_window)
self.graphicsView_2.setStyleSheet("border-image: url(:/photo/fasheaixin.gif);")
self.graphicsView_2.setObjectName("graphicsView_2")
self.horizontalLayout_2.addWidget(self.graphicsView_2)
self.line = QtWidgets.QFrame(sign_in_window)
self.line.setFrameShape(QtWidgets.QFrame.VLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.horizontalLayout_2.addWidget(self.line)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem)
self.label_3 = QtWidgets.QLabel(sign_in_window)
self.label_3.setObjectName("label_3")
self.verticalLayout_3.addWidget(self.label_3)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, -1, 0, 10)
self.horizontalLayout.setObjectName("horizontalLayout")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label = QtWidgets.QLabel(sign_in_window)
self.label.setObjectName("label")
self.verticalLayout_2.addWidget(self.label)
self.label_2 = QtWidgets.QLabel(sign_in_window)
self.label_2.setObjectName("label_2")
self.verticalLayout_2.addWidget(self.label_2)
self.horizontalLayout.addLayout(self.verticalLayout_2)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.account = QtWidgets.QLineEdit(sign_in_window)
self.account.setObjectName("account")
self.verticalLayout.addWidget(self.account)
self.secret = QtWidgets.QLineEdit(sign_in_window)
self.secret.setObjectName("secret")
self.verticalLayout.addWidget(self.secret)
self.horizontalLayout.addLayout(self.verticalLayout)
self.horizontalLayout.setStretch(0, 1)
self.horizontalLayout.setStretch(1, 3)
self.verticalLayout_3.addLayout(self.horizontalLayout)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setContentsMargins(-1, 12, 0, 0)
self.horizontalLayout_3.setSpacing(11)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem1)
self.sign_in_button = QtWidgets.QPushButton(sign_in_window)
self.sign_in_button.setObjectName("sign_in_button")
self.horizontalLayout_3.addWidget(self.sign_in_button)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem2)
self.verticalLayout_3.addLayout(self.horizontalLayout_3)
spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_3.addItem(spacerItem3)
self.verticalLayout_3.setStretch(1, 2)
self.verticalLayout_3.setStretch(2, 1)
self.verticalLayout_3.setStretch(3, 1)
self.verticalLayout_3.setStretch(4, 2)
self.horizontalLayout_2.addLayout(self.verticalLayout_3)
self.retranslateUi(sign_in_window)
QtCore.QMetaObject.connectSlotsByName(sign_in_window)
def retranslateUi(self, sign_in_window):
_translate = QtCore.QCoreApplication.translate
sign_in_window.setWindowTitle(_translate("sign_in_window", "mylover"))
self.label_3.setText(_translate("sign_in_window", "亲爱滴臭宝!请输入账号密码呦....."))
self.label.setText(_translate("sign_in_window", "账号"))
self.label_2.setText(_translate("sign_in_window", "密码"))
self.sign_in_button.setText(_translate("sign_in_window", "登录"))
import image_rc
你可能文件名不对或者是程序里哪个字母的大小写打错了或者有两个名字都是sign_in_window.py的文件,在我这怎么不报错。
|
|