и там у меня есть хендлеры (декораторы)
import sys
from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication, QLabel, QLineEdit, QMessageBox, QDialog)
from PyQt5.QtGui import QFont
from PyQt5.QtCore import QRect
from options_form import Options_form
class Pass_form(QDialog):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setFixedSize(255, 132)
self.openopt = QPushButton('Открыть',self)
self.openopt.setGeometry(QRect(50, 100, 81, 23))
self.openopt.clicked.connect(self.onClicked1)
self.cancelopt = QPushButton('Отмена',self)
self.cancelopt.setGeometry(QRect(134, 100, 81, 23))
self.label = QLabel('Логин:',self)
self.label.setGeometry(QRect(40, 40, 41, 16))
self.label_2 = QLabel('Пароль:',self)
self.label_2.setGeometry(QRect(30, 70, 48, 13))
self.lineLOGINopt = QLineEdit(self)
self.lineLOGINopt.setGeometry(QRect(80, 40, 113, 20))
self.linePASSopt = QLineEdit(self)
self.linePASSopt.setGeometry(QRect(80, 70, 111, 20))
self.label_3 = QLabel('Доступ к наcтройкам',self)
self.label_3.setGeometry(QRect(30, 10, 188, 22))
self.show()
def onClicked1(self):
l = "l"
p = "p"
msg = QMessageBox(self)
if self.lineLOGINopt.text() == l and self.linePASSopt.text() == p:
opt_window = Options_form()
opt_window.show()
opt_window.exec_()
elif self.lineLOGINopt.text() == "" and self.linePASSopt.text() == "":
msg.about(self, "Ошибка", "Введите логин и пароль.")
else:
msg.about(self, "Ошибка", "Вы ввели неверный логин или пароль.")
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Pass_form()
sys.exit(app.exec_())
# проверка на двойника
people_id = message.chat.id
cursor.execute(f"SELECT id FROM login_id WHERE id = {people_id}")
data = cursor.fetchone()
if data is None:
# добавление в базу
user_id = [message.chat.id]
cursor.execute("INSERT INTO login_id VALUES(?);", user_id)
connect.commit()
else:
bot.send_message(message.chat.id, "Такой пользователь уже существует")
from flask import Flask
from flask import render_template
from flask import Markup
app = Flask(__name__)
string = '<h1>Hello world</h1> hello_world_normal'
'''string = string.replace("<", "<")
string = string.replace(">", ">")'''
with open('templates\\rt.html','w') as temp_file:
temp_file.write(string)
@app.route('/')
def hello_world():
return Markup.escape(string)
app.run()
from ProjectUIForm import Ui_Form as Ui_F_Project
Ты импортировал и создал объекб класса,class ProjectPrg(QtWidgets.QWidget, Ui_F_Project):
def __init__(self, parent=None):
super(ProjectPrg, self).__init__(parent)
self.setupUi(self)
from flask import Flask
from flask import render_template
app = Flask(__name__)
string = '<h1>Hello world</h1> hello_world_normal'
string = string.replace("<", "<")
string = string.replace(">", ">")
with open('templates\\rt.html','w') as temp_file:
temp_file.write(string)
@app.route('/')
def hello_world():
return render_template('rt.html')
app.run()
Как перевести строку в html flask?
<
", "<")