From e2ba403784b105fc30c728a56e68fb045a1eb0e7 Mon Sep 17 00:00:00 2001 From: MrB <154423640@qq.com> Date: Mon, 15 Apr 2024 14:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BD=9C=E5=BC=8A=E7=A0=81?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/main.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/main/main.py b/main/main.py index 14cbf15..2154d5b 100644 --- a/main/main.py +++ b/main/main.py @@ -7,7 +7,7 @@ import pickle import random -from PySide6.QtCore import QTimer, Qt +from PySide6.QtCore import QTimer from PySide6.QtWidgets import * from PySide6.QtGui import QIcon from win.win import Ui_Form as Form1 @@ -139,13 +139,16 @@ class Form(Form1): def keyPressEvent(self, event): global sudo key = event.key() - - if key == self.konami_code[self.konami_index]: - self.konami_index += 1 - if self.konami_index == len(self.konami_code): - sudo.print_sudo() + try: + if key == self.konami_code[self.konami_index]: + self.konami_index += 1 + if self.konami_index == len(self.konami_code): + sudo.print_sudo() + self.konami_index = 0 + else: self.konami_index = 0 - else: + + except Exception as e: self.konami_index = 0 # self.lll.append(key) # print(self.lll) @@ -326,7 +329,7 @@ class Form(Form1): subject_with_answer = sudo.createSubjectByLevel(level).subject_with_answer del_cnt = sudo.get_del_cnt() # 打印参考答案 - sudo.print_sudo() + # sudo.print_sudo() # print(sudo) self.translate(sudo.subject)