|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 adds52339 于 2021-11-25 17:38 编辑
import sys
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtGui import QIcon
from PyQt5.QtPrintSupport import *
from PyQt5.QtCore import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(946, 655)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(670, 330, 141, 51))
self.pushButton.setObjectName("pushButton")
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(670, 390, 141, 51))
self.pushButton_2.setObjectName("pushButton_2")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(190, 40, 91, 31))
self.label.setStyleSheet("font: 25 16pt \"等线 Light\";")
self.label.setObjectName("label")
self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(30, 80, 561, 451))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.textBrowser = QtWidgets.QTextBrowser(self.verticalLayoutWidget)
self.textBrowser.setObjectName("textBrowser")
self.verticalLayout.addWidget(self.textBrowser)
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(640, 80, 221, 41))
self.lineEdit.setStyleSheet("font: 14pt \"楷体\";")
self.lineEdit.setObjectName("lineEdit")
self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_2.setGeometry(QtCore.QRect(640, 130, 221, 41))
self.lineEdit_2.setStyleSheet("font: 14pt \"黑体\";")
self.lineEdit_2.setObjectName("lineEdit_2")
self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_3.setGeometry(QtCore.QRect(640, 180, 221, 41))
self.lineEdit_3.setStyleSheet("font: 14pt \"黑体\";")
self.lineEdit_3.setObjectName("lineEdit_3")
self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_4.setGeometry(QtCore.QRect(640, 230, 221, 41))
self.lineEdit_4.setStyleSheet("font: 14pt \"黑体\";")
self.lineEdit_4.setObjectName("lineEdit_4")
self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_3.setGeometry(QtCore.QRect(450, 540, 121, 31))
self.pushButton_3.setObjectName("pushButton_3")
self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_4.setGeometry(QtCore.QRect(320, 540, 121, 31))
self.pushButton_4.setObjectName("pushButton_4")
self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_5.setGeometry(QtCore.QRect(670, 510, 141, 41))
self.pushButton_5.setObjectName("pushButton_5")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(640, 40, 121, 31))
self.label_2.setStyleSheet("font: 25 16pt \"等线 Light\";")
self.label_2.setObjectName("label_2")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(640, 290, 221, 31))
self.label_3.setStyleSheet("font: 25 16pt \"等线 Light\";")
self.label_3.setObjectName("label_3")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(650, 470, 221, 31))
self.label_4.setStyleSheet("font: 25 16pt \"等线 Light\";")
self.label_4.setObjectName("label_4")
self.label_5 = QtWidgets.QLabel(self.centralwidget)
self.label_5.setGeometry(QtCore.QRect(30, 580, 581, 31))
self.label_5.setStyleSheet("font: 25 16pt \"等线 Light\";")
self.label_5.setObjectName("label_5")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
# self.pushButton.clicked.connect(QPixmap('./image/gongpai.png'))
# self.pushButton_4.clicked.connect(self.showpushButton_4dailog)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "工牌打印"))
self.pushButton.setText(_translate("MainWindow", "单个横版工牌"))
self.pushButton_2.setText(_translate("MainWindow", "单个竖版工牌"))
self.label.setText(_translate("MainWindow", "预览图片"))
self.lineEdit.setText(_translate("MainWindow", "姓名"))
self.lineEdit_2.setText(_translate("MainWindow", "部门"))
self.lineEdit_3.setText(_translate("MainWindow", "职务"))
self.lineEdit_4.setText(_translate("MainWindow", "工号"))
self.pushButton_3.setText(_translate("MainWindow", "打印工牌"))
self.pushButton_4.setText(_translate("MainWindow", "打印设置"))
self.pushButton_5.setText(_translate("MainWindow", "合成工牌"))
self.label_2.setText(_translate("MainWindow", "第一步输入"))
self.label_3.setText(_translate("MainWindow", "第二部选择横版或竖版"))
self.label_4.setText(_translate("MainWindow", "第三部合成工牌"))
self.label_5.setText(_translate("MainWindow", "第四部点击打印设置设置版面大小后,点击打印工牌完成打印"))
# def showpushButton_4dailog(self):
# pushButton_4dailog.clicked.connect(self.pushButton_4,self)
# pushButton_4dailog.exec()
if __name__ == '__main__':
app = QApplication(sys.argv)
app.setWindowIcon(QIcon('./image/w1.png'))
MainWindow = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
以上是源代码,求各位大神棒棒忙?或者指导一下= =!!!我查了好久的代码,一直搞不懂,写进去就出错。。。不知道是逻辑有问题,还是怎么样! |
|