[分享]人生重开模拟器(GUI版)
人生重开模拟器(GUI版)2.1.6
这是我原创的一个小游戏,以后会不断升级
游戏截图:
注意:
运行依赖库:
程序代码:
1.PyQt5 2.ctypes 3.inspect
运行方法:
1.解压,运行begins文件:
就可以了.
下载:
LifeReopensForGUI.zip
(267.27 KB)
附代码
程序代码:
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Bag.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # 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_BagWindow(object): def setupUi(self, BagWindow): BagWindow.setObjectName("BagWindow") BagWindow.resize(274, 275) self.centralwidget = QtWidgets.QWidget(BagWindow) self.centralwidget.setObjectName("centralwidget") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(50, 10, 171, 31)) font = QtGui.QFont() font.setFamily("Agency FB") font.setPointSize(18) font.setBold(False) font.setWeight(50) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.formLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.formLayoutWidget.setGeometry(QtCore.QRect(30, 50, 211, 171)) self.formLayoutWidget.setObjectName("formLayoutWidget") self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) self.formLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setRowWrapPolicy(QtWidgets.QFormLayout.DontWrapRows) self.formLayout.setLabelAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.formLayout.setContentsMargins(0, 0, 0, 0) self.formLayout.setObjectName("formLayout") self.strongButton = QtWidgets.QPushButton(self.formLayoutWidget) self.strongButton.setObjectName("strongButton") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.strongButton) self.strongLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.strongLabel.setFont(font) self.strongLabel.setObjectName("strongLabel") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.strongLabel) self.iqButton = QtWidgets.QPushButton(self.formLayoutWidget) self.iqButton.setObjectName("iqButton") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.iqButton) self.iqLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.iqLabel.setFont(font) self.iqLabel.setObjectName("iqLabel") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.iqLabel) self.faceButton = QtWidgets.QPushButton(self.formLayoutWidget) self.faceButton.setObjectName("faceButton") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.faceButton) self.faceLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.faceLabel.setFont(font) self.faceLabel.setObjectName("faceLabel") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.faceLabel) self.medicinalButton = QtWidgets.QPushButton(self.formLayoutWidget) self.medicinalButton.setObjectName("medicinalButton") self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.medicinalButton) self.medicinalLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.medicinalLabel.setFont(font) self.medicinalLabel.setObjectName("medicinalLabel") self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.medicinalLabel) self.lotteryTicketLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.lotteryTicketLabel.setFont(font) self.lotteryTicketLabel.setObjectName("lotteryTicketLabel") self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.lotteryTicketLabel) self.lotteryTicketButton = QtWidgets.QPushButton(self.formLayoutWidget) self.lotteryTicketButton.setObjectName("lotteryTicketButton") self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.lotteryTicketButton) self.exitButton = QtWidgets.QPushButton(self.centralwidget) self.exitButton.setGeometry(QtCore.QRect(170, 220, 93, 28)) self.exitButton.setObjectName("exitButton") BagWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(BagWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 274, 26)) self.menubar.setObjectName("menubar") BagWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(BagWindow) self.statusbar.setObjectName("statusbar") BagWindow.setStatusBar(self.statusbar) self.retranslateUi(BagWindow) QtCore.QMetaObject.connectSlotsByName(BagWindow) def retranslateUi(self, BagWindow): _translate = QtCore.QCoreApplication.translate BagWindow.setWindowTitle(_translate("BagWindow", "背包")) self.label.setText(_translate("BagWindow", "背包")) self.strongButton.setText(_translate("BagWindow", "强壮药水")) self.strongLabel.setText(_translate("BagWindow", "数量:")) self.iqButton.setText(_translate("BagWindow", "智力药水")) self.iqLabel.setText(_translate("BagWindow", "数量:")) self.faceButton.setText(_translate("BagWindow", "美容药水")) self.faceLabel.setText(_translate("BagWindow", "数量:")) self.medicinalButton.setText(_translate("BagWindow", "药物")) self.medicinalLabel.setText(_translate("BagWindow", "数量:")) self.lotteryTicketLabel.setText(_translate("BagWindow", "数量:")) self.lotteryTicketButton.setText(_translate("BagWindow", "彩票")) self.exitButton.setText(_translate("BagWindow", "退出"))
程序代码:
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainMenu.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # 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 import sys from PyQt5.QtWidgets import QMainWindow class Ui_MainMenu(object): def setupUi(self, MainMenu): MainMenu.setObjectName("MainMenu") MainMenu.resize(800, 600) self.centralwidget = QtWidgets.QWidget(MainMenu) self.centralwidget.setObjectName("centralwidget") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(0, 0, 801, 271)) self.label.setText("") self.label.setPixmap(QtGui.QPixmap(":/png/resource Files/人生重开.png")) self.label.setScaledContents(True) self.label.setObjectName("label") self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 280, 781, 261)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.workButton = QtWidgets.QPushButton(self.verticalLayoutWidget) self.workButton.setObjectName("workButton") self.verticalLayout.addWidget(self.workButton) self.goToSchoolButton = QtWidgets.QPushButton(self.verticalLayoutWidget) self.goToSchoolButton.setObjectName("goToSchoolButton") self.verticalLayout.addWidget(self.goToSchoolButton) self.showButton = QtWidgets.QPushButton(self.verticalLayoutWidget) self.showButton.setObjectName("showButton") self.verticalLayout.addWidget(self.showButton) self.studyButton = QtWidgets.QPushButton(self.verticalLayoutWidget) self.studyButton.setObjectName("studyButton") self.verticalLayout.addWidget(self.studyButton) self.openBagButton = QtWidgets.QPushButton(self.verticalLayoutWidget) self.openBagButton.setObjectName("openBagButton") self.verticalLayout.addWidget(self.openBagButton) self.goToStoreButton = QtWidgets.QPushButton(self.verticalLayoutWidget) self.goToStoreButton.setObjectName("goToStoreButton") self.verticalLayout.addWidget(self.goToStoreButton) MainMenu.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainMenu) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26)) self.menubar.setObjectName("menubar") MainMenu.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainMenu) self.statusbar.setObjectName("statusbar") MainMenu.setStatusBar(self.statusbar) self.retranslateUi(MainMenu) QtCore.QMetaObject.connectSlotsByName(MainMenu) def retranslateUi(self, MainMenu): _translate = QtCore.QCoreApplication.translate MainMenu.setWindowTitle(_translate("MainMenu", "主界面")) self.workButton.setText(_translate("MainMenu", "工作")) self.goToSchoolButton.setText(_translate("MainMenu", "去学校")) self.showButton.setText(_translate("MainMenu", "显示属性")) self.studyButton.setText(_translate("MainMenu", "学习")) self.openBagButton.setText(_translate("MainMenu", "打开背包")) self.goToStoreButton.setText(_translate("MainMenu", "去商店")) sys.path.append(r'qrc Files') import MainMenuQrc_rc if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() # 创建窗体对象 ui = Ui_MainMenu() # 创建pyqt设计的窗体对象 ui.setupUi(MainWindow) # 调用PyQt窗体的方法对对象进行初始化设置 MainWindow.show() # 显示窗体 sys.exit(app.exec_()) # 程序关闭时退出进程
程序代码:
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Store.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # 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_StoreWindow(object): def setupUi(self, StoreWindow): StoreWindow.setObjectName("StoreWindow") StoreWindow.resize(260, 292) self.centralwidget = QtWidgets.QWidget(StoreWindow) self.centralwidget.setObjectName("centralwidget") self.label = QtWidgets.QLabel(self.centralwidget) self.label.setGeometry(QtCore.QRect(30, 10, 191, 41)) font = QtGui.QFont() font.setFamily("Agency FB") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.formLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.formLayoutWidget.setGeometry(QtCore.QRect(30, 60, 191, 171)) self.formLayoutWidget.setObjectName("formLayoutWidget") self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget) self.formLayout.setContentsMargins(0, 0, 0, 0) self.formLayout.setObjectName("formLayout") self.strongButton = QtWidgets.QPushButton(self.formLayoutWidget) self.strongButton.setObjectName("strongButton") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.strongButton) self.strongLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.strongLabel.setFont(font) self.strongLabel.setObjectName("strongLabel") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.strongLabel) self.iqButton = QtWidgets.QPushButton(self.formLayoutWidget) self.iqButton.setObjectName("iqButton") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.iqButton) self.iqLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.iqLabel.setFont(font) self.iqLabel.setObjectName("iqLabel") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.iqLabel) self.faceButton = QtWidgets.QPushButton(self.formLayoutWidget) self.faceButton.setObjectName("faceButton") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.faceButton) self.faceLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.faceLabel.setFont(font) self.faceLabel.setObjectName("faceLabel") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.faceLabel) self.medicinalButton = QtWidgets.QPushButton(self.formLayoutWidget) self.medicinalButton.setObjectName("medicinalButton") self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.medicinalButton) self.medicinalLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.medicinalLabel.setFont(font) self.medicinalLabel.setObjectName("medicinalLabel") self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.medicinalLabel) self.lotteryTicketButton = QtWidgets.QPushButton(self.formLayoutWidget) self.lotteryTicketButton.setObjectName("lotteryTicketButton") self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.lotteryTicketButton) self.lotteryTicketLabel = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Agency FB") font.setBold(True) font.setWeight(75) self.lotteryTicketLabel.setFont(font) self.lotteryTicketLabel.setObjectName("lotteryTicketLabel") self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.lotteryTicketLabel) self.exitButton = QtWidgets.QPushButton(self.centralwidget) self.exitButton.setGeometry(QtCore.QRect(160, 240, 93, 28)) self.exitButton.setObjectName("exitButton") self.DollarsLabel = QtWidgets.QLabel(self.centralwidget) self.DollarsLabel.setGeometry(QtCore.QRect(10, 240, 141, 31)) font = QtGui.QFont() font.setFamily("Agency FB") font.setPointSize(10) font.setBold(True) font.setWeight(75) self.DollarsLabel.setFont(font) self.DollarsLabel.setObjectName("DollarsLabel") StoreWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(StoreWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 260, 26)) self.menubar.setObjectName("menubar") StoreWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(StoreWindow) self.statusbar.setObjectName("statusbar") StoreWindow.setStatusBar(self.statusbar) self.retranslateUi(StoreWindow) QtCore.QMetaObject.connectSlotsByName(StoreWindow) def retranslateUi(self, StoreWindow): _translate = QtCore.QCoreApplication.translate StoreWindow.setWindowTitle(_translate("StoreWindow", "商店")) self.label.setText(_translate("StoreWindow", "商店")) self.strongButton.setText(_translate("StoreWindow", "强壮药水")) self.strongLabel.setText(_translate("StoreWindow", "价格:")) self.iqButton.setText(_translate("StoreWindow", "智力药水")) self.iqLabel.setText(_translate("StoreWindow", "价格:")) self.faceButton.setText(_translate("StoreWindow", "美容药水")) self.faceLabel.setText(_translate("StoreWindow", "价格:")) self.medicinalButton.setText(_translate("StoreWindow", "药物")) self.medicinalLabel.setText(_translate("StoreWindow", "价格:")) self.lotteryTicketButton.setText(_translate("StoreWindow", "彩票")) self.lotteryTicketLabel.setText(_translate("StoreWindow", "价格:")) self.exitButton.setText(_translate("StoreWindow", "退出")) self.DollarsLabel.setText(_translate("StoreWindow", "您的钱数:"))
程序代码:
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Study.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # 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_StudyWindow(object): def setupUi(self, StudyWindow): StudyWindow.setObjectName("StudyWindow") StudyWindow.resize(512, 117) self.centralwidget = QtWidgets.QWidget(StudyWindow) self.centralwidget.setObjectName("centralwidget") self.lcdNumber_1 = QtWidgets.QLCDNumber(self.centralwidget) self.lcdNumber_1.setGeometry(QtCore.QRect(20, 10, 101, 40)) self.lcdNumber_1.setSegmentStyle(QtWidgets.QLCDNumber.Flat) self.lcdNumber_1.setProperty("intValue", 123456) self.lcdNumber_1.setObjectName("lcdNumber_1") self.lcdNumber_2 = QtWidgets.QLCDNumber(self.centralwidget) self.lcdNumber_2.setGeometry(QtCore.QRect(200, 10, 101, 40)) self.lcdNumber_2.setSegmentStyle(QtWidgets.QLCDNumber.Flat) self.lcdNumber_2.setProperty("intValue", 123456) self.lcdNumber_2.setObjectName("lcdNumber_2") self.label_1 = QtWidgets.QLabel(self.centralwidget) self.label_1.setGeometry(QtCore.QRect(130, 10, 61, 41)) font = QtGui.QFont() font.setFamily("Baskerville Old Face") font.setPointSize(36) font.setBold(False) font.setWeight(50) self.label_1.setFont(font) self.label_1.setMidLineWidth(-4) self.label_1.setAlignment(QtCore.Qt.AlignCenter) self.label_1.setObjectName("label_1") self.label_2 = QtWidgets.QLabel(self.centralwidget) self.label_2.setGeometry(QtCore.QRect(320, 10, 61, 41)) font = QtGui.QFont() font.setFamily("Baskerville Old Face") font.setPointSize(36) font.setBold(False) font.setWeight(50) self.label_2.setFont(font) self.label_2.setMidLineWidth(-4) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.lineEdit_1 = QtWidgets.QLineEdit(self.centralwidget) self.lineEdit_1.setGeometry(QtCore.QRect(400, 10, 101, 41)) font = QtGui.QFont() font.setFamily("Agency FB") font.setPointSize(20) font.setBold(True) font.setWeight(75) self.lineEdit_1.setFont(font) self.lineEdit_1.setText("") self.lineEdit_1.setObjectName("lineEdit_1") self.checkButton = QtWidgets.QPushButton(self.centralwidget) self.checkButton.setGeometry(QtCore.QRect(410, 60, 93, 28)) self.checkButton.setObjectName("checkButton") StudyWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(StudyWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 512, 26)) self.menubar.setObjectName("menubar") StudyWindow.setMenuBar(self.menubar) self.retranslateUi(StudyWindow) QtCore.QMetaObject.connectSlotsByName(StudyWindow) def retranslateUi(self, StudyWindow): _translate = QtCore.QCoreApplication.translate StudyWindow.setWindowTitle(_translate("StudyWindow", "学习")) self.label_1.setText(_translate("StudyWindow", "+")) self.label_2.setText(_translate("StudyWindow", "=")) self.checkButton.setText(_translate("StudyWindow", "检查"))
程序代码:
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'work.ui' # # Created by: PyQt5 UI code generator 5.15.9 # # 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_WorkWindow(object): def setupUi(self, WorkWindow): WorkWindow.setObjectName("WorkWindow") WorkWindow.resize(403, 244) self.centralwidget = QtWidgets.QWidget(WorkWindow) self.centralwidget.setObjectName("centralwidget") self.textEdit = QtWidgets.QTextEdit(self.centralwidget) self.textEdit.setGeometry(QtCore.QRect(10, 10, 241, 141)) self.textEdit.setReadOnly(True) self.textEdit.setPlaceholderText("") self.textEdit.setObjectName("textEdit") self.wookingButton = QtWidgets.QPushButton(self.centralwidget) self.wookingButton.setGeometry(QtCore.QRect(260, 10, 121, 51)) self.wookingButton.setObjectName("wookingButton") self.exitButton = QtWidgets.QPushButton(self.centralwidget) self.exitButton.setGeometry(QtCore.QRect(10, 160, 93, 28)) self.exitButton.setObjectName("exitButton") WorkWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(WorkWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 403, 26)) self.menubar.setObjectName("menubar") WorkWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(WorkWindow) self.statusbar.setObjectName("statusbar") WorkWindow.setStatusBar(self.statusbar) self.retranslateUi(WorkWindow) QtCore.QMetaObject.connectSlotsByName(WorkWindow) def retranslateUi(self, WorkWindow): _translate = QtCore.QCoreApplication.translate WorkWindow.setWindowTitle(_translate("WorkWindow", "工作")) self.wookingButton.setText(_translate("WorkWindow", "工作")) self.exitButton.setText(_translate("WorkWindow", "退出工作")) if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() # 创建窗体对象 ui = Ui_WorkWindow() # 创建pyqt设计的窗体对象 ui.setupUi(MainWindow) # 调用PyQt窗体的方法对对象进行初始化设置 MainWindow.show() # 显示窗体 sys.exit(app.exec_()) # 程序关闭时退出进程
[此贴子已经被作者于2023-3-25 16:38编辑过]