import sys, random from maket import * from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import QPixmap, QImage from PyQt5.QtWidgets import QLabel class MyWin(QtWidgets.QMainWindow): def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.setWindowTitle("Исторические личности") self.NameOfPerson() self.Head() self.Nose() self.Chin() #Здесь прописываем событие нажатия на кнопки self.ui.checkButton.clicked.connect(self.CheckButton) #Кнопка проверки self.ui.nexthead.clicked.connect(self.nexthead) #Кнопка"ГоловаВперёд" self.ui.backhead.clicked.connect(self.backhead) #Кнопка"ГоловаНазад" self.ui.nextnose.clicked.connect(self.nextnose) #Кнопка"НосВперёд" self.ui.backnose.clicked.connect(self.backnose) #Кнопка"НосНазад" self.ui.nextchin.clicked.connect(self.nextchin) #Кнопка"ПодбородокВперёд" self.ui.backchin.clicked.connect(self.backchin) #Кнопка"ПодбородокНазад" #Заголовок(Выводится Имя Исторической личности) def NameOfPerson(self): # Здесь все возможные имена Исторических людей. namesofperson = [] namesofperson.append("Ярослав Мудрый") namesofperson.append("Николай II") namesofperson.append("Екатерина I") namesofperson.append("Иван IV") namesofperson.append("Александр I") namesofperson.append("Пётр I") namesofperson.append("Александр II") namesofperson.append("Александр III") namesofperson.append("Владимир Ильич Ленин") namesofperson.append("Иосиф Сталин") self.ui.nameofperson.setText(namesofperson[0]) #Блок с Собранием Лба def Head(self): # Здесь все возможные лбы Исторических людей head = [] head.append(QPixmap('images\head\head0.png')) head.append(QPixmap('images\head\head1.png')) head.append(QPixmap('images\head\head2.png')) head.append(QPixmap('images\head\head3.png')) head.append(QPixmap('images\head\head4.png')) head.append(QPixmap('images\head\head5.png')) head.append(QPixmap('images\head\head6.png')) head.append(QPixmap('images\head\head7.png')) head.append(QPixmap('images\head\head8.png')) head.append(QPixmap('images\head\head9.png')) self.ui.head.setPixmap(head[0]) #Блок с Собиранием Носа def Nose(self): # Здесь все возможные носы Исторических людей nose = [] nose.append(QPixmap('images\mnose\mnose0.png')) nose.append(QPixmap('images\mnose\mnose1.png')) nose.append(QPixmap('images\mnose\mnose2.png')) nose.append(QPixmap('images\mnose\mnose3.png')) nose.append(QPixmap('images\mnose\mnose4.png')) nose.append(QPixmap('images\mnose\mnose5.png')) nose.append(QPixmap('images\mnose\mnose6.png')) nose.append(QPixmap('images\mnose\mnose7.png')) nose.append(QPixmap('images\mnose\mnose8.png')) nose.append(QPixmap('images\mnose\mnose9.png')) self.ui.nose.setPixmap(nose[0]) #Блок с Собиранием Подбородка def Chin(self): # Здесь все возможные подбородки Исторических людей chin = [] chin.append(QPixmap('images\chin\chin0.png')) chin.append(QPixmap('images\chin\chin1.png')) chin.append(QPixmap('images\chin\chin2.png')) chin.append(QPixmap('images\chin\chin3.png')) chin.append(QPixmap('images\chin\chin4.png')) chin.append(QPixmap('images\chin\chin5.png')) chin.append(QPixmap('images\chin\chin6.png')) chin.append(QPixmap('images\chin\chin7.png')) chin.append(QPixmap('images\chin\chin8.png')) chin.append(QPixmap('images\chin\chin9.png')) self.ui.chin.setPixmap(chin[0]) # Пока пустая функция которая выполняется # при нажатии на кнопку def CheckButton(self): if self.ui.nameofperson == "Ярослав Мудрый" and self.ui.head == "images\head\head0.png" and self.ui.nose == "images\mnose\mnose0.png" and self.ui.chin == "images\chin\chin0.png": print("Правильно") else: print("Не правильно попробуй ещё раз!") #ФункцияКнопки"ВперёдГолова" def nexthead(self): pass #ФункцияКнопки"НазадГолова" def backhead(self): pass #ФункцияКнопки"ВперёдНос" def nextnose(self): pass #ФункцияКнопки"НазадНос" def backnose(self): pass #ФункцияКнопки"ВперёдПодбородок" def nextchin(self): pass #ФункцияКнопки"НазадПодбородок" def backchin(self): pass if __name__ =="__main__": app = QtWidgets.QApplication(sys.argv) myapp = MyWin() myapp.show() sys.exit(app.exec()) |
print(self.ui.nameofperson == "Ярослав Мудрый")parts of the condition asprint(self.ui.nameofperson == "Ярослав Мудрый")print(self.ui.head == "images\head\head0.png"), etc. - gil9red