Как реализовать логику расчета и отображение результата при вызове второго окна?
Проблема состоит в том, что есть определенное вводимое значение в textEdit, данные из которой нужно считать и подставить в формулу, после которую вывести в lineEdit.
Я всячески пытался, мне бы понять принцип действия в данном моменте, чтобы я понял, как считать и после подставить значение в формулу и полученный результат вывести.
Как осуществить вычисления при помощи кнопки pushButton используя значение из textEdit для вывода результат в поле lineEdit?
main.py
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from FirstW import Ui_Dialog
from SecondW import Ui_Other
app = QtWidgets.QApplication(sys.argv)
Dialog = QtWidgets.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
def openSecondW():
global Other
Other = QtWidgets.QDialog()
ui = Ui_Other()
ui.setupUi(Other)
Dialog.show()
Other.show()
ui.pushButton.clicked.connect(openSecondW)
sys.exit(app.exec_())
В данном только реализован переход между кнопкой и вторым окном, так вот, мне требуется именно во втором окне сделать вычисления.
FirstW
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'FirstW.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(1097, 703)
self.listWidget = QtWidgets.QListWidget(Dialog)
self.listWidget.setGeometry(QtCore.QRect(0, 0, 1101, 861))
self.listWidget.setObjectName("listWidget")
self.textEdit_3 = QtWidgets.QTextEdit(Dialog)
self.textEdit_3.setGeometry(QtCore.QRect(340, 20, 471, 51))
self.textEdit_3.setFocusPolicy(QtCore.Qt.NoFocus)
self.textEdit_3.setAcceptDrops(False)
self.textEdit_3.setLayoutDirection(QtCore.Qt.LeftToRight)
self.textEdit_3.setAutoFillBackground(True)
self.textEdit_3.setFrameShape(QtWidgets.QFrame.NoFrame)
self.textEdit_3.setFrameShadow(QtWidgets.QFrame.Plain)
self.textEdit_3.setMidLineWidth(1)
self.textEdit_3.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_3.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_3.setObjectName("textEdit_3")
self.textEdit_2 = QtWidgets.QTextEdit(Dialog)
self.textEdit_2.setEnabled(True)
self.textEdit_2.setGeometry(QtCore.QRect(50, 60, 351, 51))
self.textEdit_2.setAcceptDrops(True)
self.textEdit_2.setAutoFillBackground(False)
self.textEdit_2.setFrameShape(QtWidgets.QFrame.NoFrame)
self.textEdit_2.setFrameShadow(QtWidgets.QFrame.Raised)
self.textEdit_2.setLineWidth(0)
self.textEdit_2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_2.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_2.setObjectName("textEdit_2")
self.textEdit_4 = QtWidgets.QTextEdit(Dialog)
self.textEdit_4.setGeometry(QtCore.QRect(860, 60, 221, 41))
self.textEdit_4.setFrameShape(QtWidgets.QFrame.NoFrame)
self.textEdit_4.setObjectName("textEdit_4")
self.textEdit = QtWidgets.QTextEdit(Dialog)
self.textEdit.setEnabled(True)
self.textEdit.setGeometry(QtCore.QRect(30, 110, 1061, 81))
self.textEdit.setObjectName("textEdit")
self.pushButton = QtWidgets.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(920, 140, 101, 31))
self.pushButton.setMinimumSize(QtCore.QSize(0, 31))
self.pushButton.setObjectName("pushButton")
self.textEdit_5 = QtWidgets.QTextEdit(Dialog)
self.textEdit_5.setEnabled(True)
self.textEdit_5.setGeometry(QtCore.QRect(30, 210, 1061, 111))
self.textEdit_5.setObjectName("textEdit_5")
self.pushButton_2 = QtWidgets.QPushButton(Dialog)
self.pushButton_2.setGeometry(QtCore.QRect(920, 250, 101, 31))
self.pushButton_2.setObjectName("pushButton_2")
self.textEdit_6 = QtWidgets.QTextEdit(Dialog)
self.textEdit_6.setEnabled(True)
self.textEdit_6.setGeometry(QtCore.QRect(30, 330, 1061, 81))
self.textEdit_6.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_6.setObjectName("textEdit_6")
self.textEdit_7 = QtWidgets.QTextEdit(Dialog)
self.textEdit_7.setEnabled(True)
self.textEdit_7.setGeometry(QtCore.QRect(30, 430, 1061, 121))
self.textEdit_7.setObjectName("textEdit_7")
self.textEdit_8 = QtWidgets.QTextEdit(Dialog)
self.textEdit_8.setEnabled(True)
self.textEdit_8.setGeometry(QtCore.QRect(30, 560, 1061, 101))
self.textEdit_8.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_8.setObjectName("textEdit_8")
self.pushButton_3 = QtWidgets.QPushButton(Dialog)
self.pushButton_3.setGeometry(QtCore.QRect(920, 360, 101, 31))
self.pushButton_3.setObjectName("pushButton_3")
self.pushButton_4 = QtWidgets.QPushButton(Dialog)
self.pushButton_4.setGeometry(QtCore.QRect(920, 470, 101, 31))
self.pushButton_4.setObjectName("pushButton_4")
self.pushButton_5 = QtWidgets.QPushButton(Dialog)
self.pushButton_5.setGeometry(QtCore.QRect(920, 600, 101, 31))
self.pushButton_5.setObjectName("pushButton_5")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.textEdit_3.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:20pt; font-weight:600;\">Простые линейные структуры </span></p></body></html>"))
self.textEdit_2.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:16pt;\">Корнеенков Антон IBT-12</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:16pt;\"><br /></p></body></html>"))
self.textEdit_4.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:16pt;\">Вариант 8</span></p></body></html>"))
self.textEdit.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Задание №1</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Найти длину окружности, площадь круга и объем шара одного и того же заданного радиуса R</span></p></body></html>"))
self.pushButton.setText(_translate("Dialog", "Решение"))
self.textEdit_5.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Задание №2</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Составьте алгоритм и программу для определения сдачи после покупки в магазине товара:</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">перчаток стоимостью а руб., портфеля стоимостью b руб., галстука стоимостью с руб. </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Исходная сумма выделенная на покупку - d руб. В случае не хватки денег сдача поулчится отрицательной.</span></p></body></html>"))
self.pushButton_2.setText(_translate("Dialog", "Решение"))
self.textEdit_6.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Задание №3</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:11pt; font-weight:600;\">Найти первую цифру в десятичной записи четырехзначного натурального числа</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; font-weight:600;\"><br /></p></body></html>"))
self.textEdit_7.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Задание №4</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">Идет 13257-я секунда суток. Определить сколько полных часов (h) и полных минут (m) </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">прошло к этому моменту и вывести данное значение длительности в часах, минутах и секундах </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">в следующей форме : HH часов MM минут SS секунд</span></p></body></html>"))
self.textEdit_8.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt;\">Задание №5</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">По номеру квартиры определить, в каком подъезде и на каком этаже эта квартира находится. </span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:12pt; font-weight:600;\">Дом пятиэтажный, на каждом по 4 квартиры</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;\"><br /></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;\"><br /></p></body></html>"))
self.pushButton_3.setText(_translate("Dialog", "Решение"))
self.pushButton_4.setText(_translate("Dialog", "Решение"))
self.pushButton_5.setText(_translate("Dialog", "Решение"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Dialog = QtWidgets.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec_())
SecondW.py
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Other(object):
def setupUi(self, Other):
Other.setObjectName("Other")
Other.resize(572, 448)
self.listWidget = QtWidgets.QListWidget(Other)
self.listWidget.setGeometry(QtCore.QRect(-10, -10, 851, 661))
self.listWidget.setObjectName("listWidget")
self.pushButton56 = QtWidgets.QPushButton(Other)
self.pushButton56.setGeometry(QtCore.QRect(340, 350, 131, 41))
self.pushButton56.setObjectName("pushButton56")
self.textEdit = QtWidgets.QTextEdit(Other)
self.textEdit.setEnabled(True)
self.textEdit.setGeometry(QtCore.QRect(50, 90, 181, 31))
self.textEdit.setFrameShape(QtWidgets.QFrame.NoFrame)
self.textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit.setObjectName("textEdit")
self.lineEdit_2 = QtWidgets.QLineEdit(Other)
self.lineEdit_2.setGeometry(QtCore.QRect(340, 150, 113, 20))
self.lineEdit_2.setObjectName("lineEdit_2")
self.lineEdit_3 = QtWidgets.QLineEdit(Other)
self.lineEdit_3.setGeometry(QtCore.QRect(340, 190, 113, 20))
self.lineEdit_3.setObjectName("lineEdit_3")
self.lineEdit_4 = QtWidgets.QLineEdit(Other)
self.lineEdit_4.setGeometry(QtCore.QRect(340, 230, 113, 20))
self.lineEdit_4.setObjectName("lineEdit_4")
self.textEdit_2 = QtWidgets.QTextEdit(Other)
self.textEdit_2.setGeometry(QtCore.QRect(50, 140, 104, 21))
self.textEdit_2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_2.setObjectName("textEdit_2")
self.retranslateUi(Other)
QtCore.QMetaObject.connectSlotsByName(Other)
def retranslateUi(self, Other):
_translate = QtCore.QCoreApplication.translate
Other.setWindowTitle(_translate("Other", "Dialog"))
self.pushButton56.setText(_translate("Other", "Вычислить"))
self.textEdit.setHtml(_translate("Other", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600;\">Радиус</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt; font-weight:600;\"><br /></p></body></html>"))
self.lineEdit_2.setText(_translate("Other", "0"))
Ответы (1 шт):
Объектно-ориентированное программирование.
QString QTextEdit::toPlainText() const
Возвращает текст редактирования текста как обычный текст.
text : QString
Установка этого свойства очищает выбор, очищает историю отмен/повторов, перемещает курсор в конец строки и сбрасывает измененное свойство на false. Текст не проверяется при вставке с помощью setText().
import sys
import math
from PyQt5 import QtCore, QtGui, QtWidgets
# ??? from FirstW import Ui_Dialog
#from SecondW import Ui_Other
class Ui_Other(object):
def setupUi(self, Other):
Other.setObjectName("Other")
Other.resize(572, 448)
self.listWidget = QtWidgets.QListWidget(Other)
self.listWidget.setGeometry(QtCore.QRect(-10, -10, 851, 661))
self.listWidget.setObjectName("listWidget")
self.pushButton56 = QtWidgets.QPushButton(Other)
self.pushButton56.setGeometry(QtCore.QRect(340, 350, 131, 41))
self.pushButton56.setObjectName("pushButton56")
self.textEdit = QtWidgets.QTextEdit(Other)
self.textEdit.setEnabled(True)
self.textEdit.setGeometry(QtCore.QRect(50, 90, 181, 31))
self.textEdit.setFrameShape(QtWidgets.QFrame.NoFrame)
self.textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit.setObjectName("textEdit")
self.lineEdit_2 = QtWidgets.QLineEdit(Other)
self.lineEdit_2.setGeometry(QtCore.QRect(340, 150, 113, 20))
self.lineEdit_2.setObjectName("lineEdit_2")
self.lineEdit_3 = QtWidgets.QLineEdit(Other)
self.lineEdit_3.setGeometry(QtCore.QRect(340, 190, 113, 20))
self.lineEdit_3.setObjectName("lineEdit_3")
self.lineEdit_4 = QtWidgets.QLineEdit(Other)
self.lineEdit_4.setGeometry(QtCore.QRect(340, 230, 113, 20))
self.lineEdit_4.setObjectName("lineEdit_4")
self.textEdit_2 = QtWidgets.QTextEdit(Other)
self.textEdit_2.setGeometry(QtCore.QRect(50, 140, 104, 21))
self.textEdit_2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.textEdit_2.setObjectName("textEdit_2")
self.retranslateUi(Other)
QtCore.QMetaObject.connectSlotsByName(Other)
def retranslateUi(self, Other):
_translate = QtCore.QCoreApplication.translate
Other.setWindowTitle(_translate("Other", "Dialog"))
self.pushButton56.setText(_translate("Other", "Вычислить"))
self.textEdit.setHtml(_translate("Other", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:14pt; font-weight:600;\">Радиус</span></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:14pt; font-weight:600;\"><br /></p></body></html>"))
self.lineEdit_2.setText(_translate("Other", "0"))
class Other(QtWidgets.QDialog, Ui_Other):
def __init__(self):
super().__init__()
self.setupUi(self)
self.pi = math.pi
self.pushButton56.clicked.connect(self.result)
def result(self):
r = self.textEdit_2.toPlainText()
if r:
p = 2 * float(r) * self.pi
self.lineEdit_2.setText(f"p = {p:.3f}")
class Dialog(QtWidgets.QDialog):
def __init__(self):
super().__init__()
self.pushButton = QtWidgets.QPushButton('Решение', self)
self.pushButton.clicked.connect(self.openSecondW)
self.other = Other()
def openSecondW(self):
self.other.show()
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
w = Dialog()
w.show()
sys.exit(app.exec_())


