class ThirdPage(QMainWindow): def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.pushButton.clicked.connect(self.clk) self.succes = Success() self.fail = Fail() def refresh(self, key): self.key = key self.analyze() def analyze(self): if self.key == 1: self.succes.show() else: self.fail.show() def clk(self): from main_page import MainPage self.giris = MainPage() self.giris.show() self.close()
class AThirdPage(QMainWindow): def __init__(self): super().__init__() self.ui = Ui_admin2() self.ui.setupUi(self) self.ui.pushButton.clicked.connect(self.page1) self.ui.pushButton_2.clicked.connect(self.page2) self.ui.pushButton_3.clicked.connect(self.page3) self.ui.pushButton_4.clicked.connect(self.mainpage) self.admin3 = AFPage() self.admin4 = AGPage() def page1(self): self.admin3.show() def page2(self): self.admin4.show() def page3(self): import read_data read_data.transfer() def mainpage(self): from main_page import MainPage self.giris = MainPage() self.giris.show() self.close()
class MainView(tk.Frame): def __init__(self, *args, **kwargs): tk.Frame.__init__(self, *args, **kwargs) self.container = tk.Frame(self) self.container.pack(side="top", fill="both", expand=True) self.show_main_page() def show_main_page(self): self.main_page = MainPage(master=self) self.main_page.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) self.main_page.show() def show_new_review_page(self, review): self.review_page = ReviewPage(master=self, review=review) self.review_page.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) self.review_page.show() def show_view_all_page(self): self.view_all_page = ViewAllPage(master=self) self.view_all_page.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) self.view_all_page.show() def show_add_flashcard_page(self): self.add_flashcard_page = AddFlashcard(master=self) self.add_flashcard_page.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) self.add_flashcard_page.show() def show_edit_flashcard_page(self, flashcard): self.edit_flashcard_page = EditFlashcard(master=self, flashcard=flashcard) self.edit_flashcard_page.place(in_=self.container, x=0, y=0, relwidth=1, relheight=1) self.edit_flashcard_page.show()
class SecondPage(QMainWindow): def __init__(self): super().__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.comboBox.addItem("0", 0) self.ui.comboBox.addItem("1", 1) self.ui.comboBox.addItem("2", 2) self.ui.comboBox.addItem("3", 3) self.ui.comboBox.addItem("4", 4) self.ui.comboBox.addItem("5", 5) self.ui.comboBox.addItem("6", 6) self.ui.comboBox.addItem("7", 7) self.ui.comboBox.addItem("8", 8) self.ui.comboBox.addItem("9", 9) self.ui.comboBox_2.addItem("0", 0) self.ui.comboBox_2.addItem("1", 1) self.ui.comboBox_2.addItem("2", 2) self.ui.comboBox_2.addItem("3", 3) self.ui.comboBox_2.addItem("4", 4) self.ui.comboBox_2.addItem("5", 5) self.ui.comboBox_2.addItem("6", 6) self.ui.comboBox_2.addItem("7", 7) self.ui.comboBox_2.addItem("8", 8) self.ui.comboBox_2.addItem("9", 9) self.ui.comboBox_3.addItem("0", 0) self.ui.comboBox_3.addItem("1", 1) self.ui.comboBox_3.addItem("2", 2) self.ui.comboBox_3.addItem("3", 3) self.ui.comboBox_3.addItem("4", 4) self.ui.comboBox_3.addItem("5", 5) self.ui.comboBox_3.addItem("6", 6) self.ui.comboBox_3.addItem("7", 7) self.ui.comboBox_3.addItem("8", 8) self.ui.comboBox_3.addItem("9", 9) self.ui.comboBox_4.addItem("0", 0) self.ui.comboBox_4.addItem("1", 1) self.ui.comboBox_4.addItem("2", 2) self.ui.comboBox_4.addItem("3", 3) self.ui.comboBox_4.addItem("4", 4) self.ui.comboBox_4.addItem("5", 5) self.ui.comboBox_4.addItem("6", 6) self.ui.comboBox_4.addItem("7", 7) self.ui.comboBox_4.addItem("8", 8) self.ui.comboBox_4.addItem("9", 9) self.ui.pushButton.clicked.connect(self.clk) self.ui.pushButton_2.clicked.connect(self.clk2) self.admin2 = AThirdPage() def clk(self): import numpy as np import pandas as pd df = pd.read_excel('passwords.xls') Id = df['Id'] Password0 = df['Password0'] Password1 = df['Password1'] Password2 = df['Password2'] Password3 = df['Password3'] key_0 = self.ui.comboBox.currentText() key_1 = self.ui.comboBox_2.currentText() key_2 = self.ui.comboBox_3.currentText() key_3 = self.ui.comboBox_4.currentText() new_password = np.array( [int(key_0), int(key_1), int(key_2), int(key_3)]) admin_password = np.array( [Password0[0], Password1[0], Password2[0], Password3[0]]) if (admin_password == new_password).all(): print("Login Confirmed") self.admin2.show() self.close() else: print("Entry Denied") def clk2(self): from main_page import MainPage self.giris = MainPage() self.giris.show() self.close()
from PyQt5.QtWidgets import QApplication from main_page import MainPage app = QApplication([]) window = MainPage() window.show() app.exec_()