Set text doesnt set text...
-
Hello guys, please i already made similar topic but in this one iam using classes and iam facing same problem... This code just dont work and i have NO idea why. Function setExpresion in main.py is executed but doesnt set text...
File main.py
from PyQt5 import QtWidgets import sys from PyQt5.QtWidgets import QMainWindow, QApplication, QLineEdit class Window(QMainWindow): def __init__(self): super().__init__() self.textboxvalue2 = "" self.setWindowTitle("Samuel") self.setGeometry(200, 200, 259, 258) self.textbox = QLineEdit(self) self.textbox.move(5, 5) self.textbox.resize(188, 35) self.textbox.setText(str(self.textboxvalue2)) self.textbox.setPlaceholderText("Enter numbers") self.textboxValue = self.textbox.text() self.b10 = QtWidgets.QPushButton(self) self.b10.setText("0") self.b10.move(68, 219) self.b10.resize(60, 35) self.b10.clicked.connect(self.clicked0) self.show() def setExpression(self,expression): print(expression) self.textbox.setText(str(expression)) def clicked0(self): import Buttons z = Buttons.Buttons() z.buttonOne() if __name__ == "__main__": app = QApplication(sys.argv) window = Window() sys.exit(app.exec())File Buttons.py
class Buttons: def buttonOne(self): import main x = main.Window() x.setExpression("1") -
Thank you now it is working !!!!!