Сбой после помещения данных запросов в setText() и для всех setText() в QT Designer.... как это исправить?
Я делаю админ панель для себя и я хочу чтобы по нажатию кнопки мне выводило цену предметов на данный момент. но у меня крашит скрипт при попытке использовать setText(). Как это исправить? main.py
from PyQt6 import uic, QtWidgets
from PyQt6.QtWidgets import QApplication, QDialog
from PyQt6.uic.properties import QtWidgets
from requests import *
from SimpleQIWI import *
from auth_token import token, phone
import webbrowser
from CasePrices import *
from FAFTUI import *
import sys
Form, Window = uic.loadUiType("FAFTUI.ui")
app = QApplication([])
window = Window()
form = Form()
form.setupUi(window)
window.show()
class Main(QDialog, Ui_FAFTUI):
def __init__(self):
super(Main, self).__init__()
self.setupUi(self)
class Child(QDialog, Ui_CasePrices):
def __init__(self):
super(Child, self).__init__()
self.setupUi(self)
def OPEN(self):
self.show()
api = QApi(token=token, phone=phone)
networse = form.networse_2.alignment()
percent2 = 5.5
price2 = networse * percent2 / 100
percent1 = 5 + (price2 * 10 / 100)
percent3 = 1
price1 = networse * percent1 / 100
price3 = networse * percent3 / 100
user1 = '@twisttyy'
user2 = '@sashok'
user3 = '@invalid_na...'
def recoil():
req = requests.get(
'http://steamcommunity.com/market/priceoverview/?appid=730¤cy=5&market_hash_name=Recoil Case')
responce = req.json()
info = responce["lowest_price"]
ui.prb1.setText(info)
print(info)
def fracture():
req = requests.get(
'http://steamcommunity.com/market/priceoverview/?appid=730¤cy=5&market_hash_name=Fracture Case')
responce = req.json()
info = responce["lowest_price"]
ui.prb2.setText()
print(info)
def snakebite(self):
req = requests.get(
'http://steamcommunity.com/market/priceoverview/?appid=730¤cy=5&market_hash_name=Snakebite Case')
responce = req.json()
info = responce["lowest_price"]
ui.prb3.setText(info)
print(info)
def DNS():
req = requests.get(
'http://steamcommunity.com/market/priceoverview/?appid=730¤cy=5&market_hash_name=Dreams%20%26%20Nightmares%20Case')
responce = req.json()
info = responce["lowest_price"]
print(info)
def clutch():
req = requests.get(
'http://steamcommunity.com/market/priceoverview/?appid=730¤cy=5&market_hash_name=Clutch Case')
responce = req.json()
info = responce["lowest_price"]
print(info)
def prisma2():
req = requests.get(
'http://steamcommunity.com/market/priceoverview/?appid=730¤cy=5&market_hash_name=Prisma 2 Case')
responce = req.json()
info = responce["lowest_price"]
print(info)
def babkivsem():
api.pay(account="+79167706785", amount=price1, comment='Ваш Доход с фермы!')
api.pay(account="+79256523786", amount=price2, comment='Ваш Доход с фермы!')
api.pay(account="+79031380675", amount=price3, comment='Ваш Доход с фермы!')
def babki1():
api.pay(account="+79167706785", amount=price1, comment='Ваш Доход с фермы!')
print(price1, 'Отправлены', user1)
def babki2():
api.pay(account="+79256523786", amount=price2, comment='Ваш Доход с фермы!')
print(price1, 'Отправлены', user2)
def babki3():
api.pay(account="+79031380675", amount=price3, comment='Ваш Доход с фермы!')
print(price1, 'Отправлены', user3)
def tg1():
webbrowser.open('https://t.me/ZiFlux', new=0)
def tg2():
webbrowser.open('https://t.me/csgofarmbot', new=0)
def tg3():
webbrowser.open('https://t.me/csgocasefarmbot', new=0)
ch = Child()
form.PriceButton.clicked.connect(ch.OPEN)
form.pushButton_13.clicked.connect(tg1)
form.pushButton_2.clicked.connect(tg2)
form.pushButton_12.clicked.connect(tg3)
form.client1.clicked.connect(babki1)
form.client2.clicked.connect(babki2)
form.client3.clicked.connect(babki3)
form.PriceButton.clicked.connect(recoil)
form.PriceButton.clicked.connect(fracture)
form.PriceButton.clicked.connect(snakebite)
form.PriceButton.clicked.connect(DNS)
form.PriceButton.clicked.connect(clutch)
form.PriceButton.clicked.connect(prisma2)
app.exec()
CasePrices.py
# Form implementation generated from reading ui file 'C:\Users\irsha\PycharmProjects\FAFT\CasePrices.ui'
#
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_CasePrices(object):
def setupUi(self, CasePrices):
CasePrices.setObjectName("CasePrices")
CasePrices.resize(371, 461)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("C:\\Users\\irsha\\PycharmProjects\\FAFT\\icon.ico"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
CasePrices.setWindowIcon(icon)
CasePrices.setStyleSheet("QDialog {\n"
" background-color: #232323;\n"
"}")
self.verticalLayoutWidget = QtWidgets.QWidget(CasePrices)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 0, 209, 461))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_2.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 40px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_2.setObjectName("label_2")
self.verticalLayout.addWidget(self.label_2)
self.label = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_4.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_4.setObjectName("label_4")
self.verticalLayout.addWidget(self.label_4)
self.label_3 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_3.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_3.setObjectName("label_3")
self.verticalLayout.addWidget(self.label_3)
self.label_5 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_5.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_5.setObjectName("label_5")
self.verticalLayout.addWidget(self.label_5)
self.label_6 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_6.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_6.setObjectName("label_6")
self.verticalLayout.addWidget(self.label_6)
self.label_7 = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label_7.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_7.setObjectName("label_7")
self.verticalLayout.addWidget(self.label_7)
self.verticalLayoutWidget_2 = QtWidgets.QWidget(CasePrices)
self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(230, 60, 131, 411))
self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.prb1 = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.prb1.setStyleSheet("QPushButton {\n"
" background-color: gold;\n"
" width: 100px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" background-color: orange;\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" background-color: yellow;\n"
"}")
self.prb1.setObjectName("prb1")
self.verticalLayout_2.addWidget(self.prb1)
self.prb2 = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.prb2.setStyleSheet("QPushButton {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" background-color: orange;\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" background-color: yellow;\n"
"}")
self.prb2.setObjectName("prb2")
self.verticalLayout_2.addWidget(self.prb2)
self.prb3 = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.prb3.setStyleSheet("QPushButton {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" background-color: orange;\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" background-color: yellow;\n"
"}")
self.prb3.setObjectName("prb3")
self.verticalLayout_2.addWidget(self.prb3)
self.prb4 = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.prb4.setStyleSheet("QPushButton {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" background-color: orange;\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" background-color: yellow;\n"
"}")
self.prb4.setObjectName("prb4")
self.verticalLayout_2.addWidget(self.prb4)
self.prb4_2 = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.prb4_2.setStyleSheet("QPushButton {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" background-color: orange;\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" background-color: yellow;\n"
"}")
self.prb4_2.setObjectName("prb4_2")
self.verticalLayout_2.addWidget(self.prb4_2)
self.prb5 = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
self.prb5.setStyleSheet("QPushButton {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 14px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"\n"
"QPushButton:hover {\n"
" background-color: orange;\n"
"}\n"
"\n"
"QPushButton:pressed {\n"
" background-color: yellow;\n"
"}")
self.prb5.setObjectName("prb5")
self.verticalLayout_2.addWidget(self.prb5)
self.label_8 = QtWidgets.QLabel(CasePrices)
self.label_8.setGeometry(QtCore.QRect(230, 0, 131, 61))
self.label_8.setStyleSheet("QLabel {\n"
" background-color: gold;\n"
" width: 75px;\n"
" height: 50px;\n"
" font-size: 40px;\n"
" font-weight: bold;\n"
" border: none;\n"
" text-align: center;\n"
"}\n"
"")
self.label_8.setObjectName("label_8")
self.retranslateUi(CasePrices)
QtCore.QMetaObject.connectSlotsByName(CasePrices)
def retranslateUi(self, CasePrices):
_translate = QtCore.QCoreApplication.translate
CasePrices.setWindowTitle(_translate("CasePrices", "Dialog"))
self.label_2.setText(_translate("CasePrices", " Кейс"))
self.label.setText(_translate("CasePrices", "Гремучий кейс:"))
self.label_4.setText(_translate("CasePrices", "Кейс Разлом:"))
self.label_3.setText(_translate("CasePrices", "Змеиный укус:"))
self.label_5.setText(_translate("CasePrices", "Кейс Грёзы и Кошмары:"))
self.label_6.setText(_translate("CasePrices", "Кейс Решающий момент:"))
self.label_7.setText(_translate("CasePrices", "Призма 2 Кейс:"))
self.prb1.setText(_translate("CasePrices", "PushButton"))
self.prb2.setText(_translate("CasePrices", "PushButton"))
self.prb3.setText(_translate("CasePrices", "PushButton"))
self.prb4.setText(_translate("CasePrices", "PushButton"))
self.prb4_2.setText(_translate("CasePrices", "PushButton"))
self.prb5.setText(_translate("CasePrices", "PushButton"))
self.label_8.setText(_translate("CasePrices", " Цена"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
CasePrices = QtWidgets.QDialog()
ui = Ui_CasePrices()
ui.setupUi(CasePrices)
CasePrices.show()
sys.exit(app.exec())
auth_token.py - просто апи + номер телефона для либов P.S. Я начал изучать QT 2 дня назад, и мне очень жаль, если мой код такой ужасный. Если нужен FAFTUI.py напишите об этом.