Пишу программу-таймер , нужно что-бы при вводе в отдельном диалоговом окне(second_win) в LineEdit этот текст переносился в название таймера в первом окне (main_win) и заменял лейбл.
Не могу понять как изменить данные label в классе Ui_MainWindow из класса в другом файле Ui_SecondWindow.
Вот код:
main_win(кусочек)
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QPushButton, QVBoxLayout, QHBoxLayout, QLineEdit
from PyQt5.QtCore import QTimer, QTime
import pytz
from datetime import datetime
from time import *
from win10toast import *
import textur
from secondwin import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(364, 160)
MainWindow.setWindowTitle(":)")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
icon = QtGui.QIcon.fromTheme("21421")
#лево первый
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(10, 20, 31, 31))
self.label_2.setPixmap(QtGui.QPixmap(":/boss/1/amaitem61.png"))
self.label_2.setObjectName("label_2")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(60, 10, 47, 13))
self.label.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label.setObjectName("label")
self.horizontalSlider1 = QtWidgets.QSlider(self.centralwidget)
self.horizontalSlider1.setGeometry(QtCore.QRect(50, 30, 41, 22))
self.horizontalSlider1.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider1.setObjectName("horizontalSlider1")
self.label_1 = QtWidgets.QLabel(self.centralwidget)
self.label_1.setGeometry(QtCore.QRect(110, 10, 47, 13))
self.label_1.setObjectName("label_1")
self.pushButton_1 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_1.setGeometry(QtCore.QRect(100, 30, 41, 21))
self.pushButton_1.setObjectName("pushButton_1")
self.pushButton1 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton1.setGeometry(QtCore.QRect(140, 30, 31, 20))
self.pushButton1.setIcon(icon)
self.pushButton1.setObjectName("pushButton1")
second_win
from PyQt5 import QtCore, QtGui, QtWidgets
from ezzwipe_example import *
class Ui_SecondWindow(object):
def __init__(self,Ui_MainWindow):
super(Ui_MainWindow).__init__()
def setupUi(self, SecondWindow):
SecondWindow.setObjectName("SecondWindow")
SecondWindow.resize(248, 105)
self.centralwidget = QtWidgets.QWidget(SecondWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButtonWin = QtWidgets.QPushButton(self.centralwidget)
self.pushButtonWin.setGeometry(QtCore.QRect(80, 70, 75, 23))
self.pushButtonWin.setObjectName("pushButton")
self.pushButtonWin.clicked.connect(self.getText)
self.label111 = QtWidgets.QLabel(self.centralwidget)
self.label111.setGeometry(QtCore.QRect(50, 10, 151, 20))
self.label111.setObjectName("label")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(60, 40, 121, 20))
self.lineEdit.setText("")
self.lineEdit.setObjectName("lineEdit")
SecondWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(SecondWindow)
QtCore.QMetaObject.connectSlotsByName(SecondWindow)
def retranslateUi(self, SecondWindow):
_translate = QtCore.QCoreApplication.translate
SecondWindow.setWindowTitle(_translate("SecondWindow", ":)"))
self.pushButtonWin.setText(_translate("SecondWindow", "Изменить"))
self.label111.setText(_translate("SecondWindow", "Введите название таймера:"))
def getText(self) :
self.label.setText(self.lineEdit.text())