1062195630 发表于 2021-8-5 17:56:24

gui问题求助pyqt

本帖最后由 1062195630 于 2021-8-5 18:05 编辑

设计的界面长这样


为啥实际python跑出来长这样


代码如下
主程序
import sign_in_window
import sys
from PyQt5.QtWidgets import QApplication,QMainWindow
if __name__ == '__main__':
    app=QApplication(sys.argv)
    singin_window=QMainWindow()
    ui=sign_in_window.Ui_sign_in_window()
    ui.setupUi(singin_window)
    singin_window.show()
    sys.exit(app.exec_())

sign_in_window程序如下
# -*- 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(:/sign_in/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 sign_in_rc

nahongyan1997 发表于 2021-8-5 17:58:14

那么你的问题是什么呢?

1062195630 发表于 2021-8-5 18:05:52

nahongyan1997 发表于 2021-8-5 17:58
那么你的问题是什么呢?

不好意思发错图了

南归 发表于 2021-8-5 18:09:47

看着真头痛

nahongyan1997 发表于 2021-8-5 18:11:16

不会用布局

nahongyan1997 发表于 2021-8-11 09:09:16

是不是不同的文件夹下有重复的文件啊
页: [1]
查看完整版本: gui问题求助pyqt