добавил лягушек и презентицию

This commit is contained in:
jaba
2023-01-30 17:59:46 +07:00
parent e8be151a72
commit a451ce7e84
5 changed files with 193 additions and 3 deletions
View File
+1 -1
View File
@@ -1,4 +1,4 @@
[Settings] [Settings]
difficulty = Простая difficulty = Ïðîñòàÿ
sound = True sound = True
+140
View File
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>377</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">
background-color: rgb(28, 28, 28);</string>
</property>
<widget class="QPushButton" name="Check_Button">
<property name="geometry">
<rect>
<x>140</x>
<y>320</y>
<width>140</width>
<height>40</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe UI Semibold</family>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color:rgb(38, 38, 38);
color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string>check</string>
</property>
</widget>
<widget class="QLabel" name="Authorization">
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>211</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe UI Semibold</family>
<pointsize>20</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string>Authorization</string>
</property>
</widget>
<widget class="QLabel" name="Login">
<property name="geometry">
<rect>
<x>30</x>
<y>120</y>
<width>91</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe UI Semibold</family>
<pointsize>20</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string>Login</string>
</property>
</widget>
<widget class="QLabel" name="Password">
<property name="geometry">
<rect>
<x>30</x>
<y>200</y>
<width>141</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe UI Semibold</family>
<pointsize>20</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(85, 170, 0);</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<widget class="QLineEdit" name="Password_input">
<property name="geometry">
<rect>
<x>190</x>
<y>210</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
</widget>
<widget class="QLineEdit" name="Login_input">
<property name="geometry">
<rect>
<x>190</x>
<y>130</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
+51 -1
View File
@@ -1,4 +1,8 @@
from loguru import logger from loguru import logger
from PyQt5 import uic
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QDialog
from PyQt5.QtGui import QIcon
from modules.Game import Game from modules.Game import Game
from modules.Mathematics import start_calculating from modules.Mathematics import start_calculating
@@ -12,6 +16,52 @@ def main():
game = Game(difficulty) game = Game(difficulty)
game.start() game.start()
class Login(QDialog):
"""авторизация пользователя по логину и паролю"""
if __name__ == '__main__': def __init__(self):
super().__init__()
self.w1 = None
uic.loadUi('login.ui', self)
self.setWindowIcon(QIcon('web.png'))
"""задаём в качевстве иконки приложения мою любимую пикчу с жабой"""
"""любите жаб!"""
self.setWindowTitle('login')
self.Check_Button.clicked.connect(self.autorization)
def show_window_1(self):
self.w1 = Login()
self.Check_Button.clicked.connect(self.autorization)
self.w1.Check_Button.clicked.connect(self.w1.close)
self.w1.show()
def autorization(self):
"""функция отвечающая за проверку введённого пароля"""
login = "j"
password = "y"
full_password = "your"
full_login = "jaba"
if self.Login_input.text() == login and \
self.Password_input.text() == password:
main() main()
elif self.Login_input.text() == full_login and \
self.Password_input.text() == full_password:
"""записываем результаты ввода пароля в файл check.txt
(разные возможности в зависимости от пользователя)"""
check = open("check.txt", mode="r")
if not check.readline():
check = open("check.txt", mode="w", encoding='UTF-8')
check.write('успешно')
check.close()
main()
def start():
"""запуск окна авторизации"""
app = QApplication(sys.argv)
ex = Login()
ex.show()
sys.exit(app.exec())
start()
View File