W
W
Wet_Dumplings2018-10-05 12:47:32
Python
Wet_Dumplings, 2018-10-05 12:47:32

How to fill a string with the result of an action?

Hello!!!
I'm trying to attach graphics to a client-server application, but I can't write down 3 variables to send, or even enter the result locally in the field.
How actually all this business can be saved in a variable?

from PyQt5.Qt import *


class Window(QWidget):
    def __init__(self):
        super().__init__()

        self.sb_num1 = QSpinBox()
        self.sb_num2 = QSpinBox()

        self.cb_op = QComboBox()
        self.cb_op.addItems(['+', '-', '/', '*'])

        layout = QFormLayout()
        self.setLayout(layout)

        layout.addRow('num1', self.sb_num1)#вот
        layout.addRow('num2', self.sb_num2)#эту
        layout.addRow('op', self.cb_op)#троицу упаковать хотелось бы в folder = a + b + c

        be=2 #<==вот даже такое число вставлять не хочет,не говоря о результатах
        self.result = QLineEdit('X___X',self) #X__X почемуто пишет и даже стирать можно, число же вставлять не хочет
        self.result.move(150, 88)#а вот сюда как-то отправить уже результат result  ;/


        self.setGeometry(300, 300, 290, 150)
        self.setWindowTitle('broken garbage')


if __name__ == '__main__':
    app = QApplication([])

    mw = Window()
    mw.show()

    app.exec()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Statkevich, 2018-10-05
@MadInc

read about pyqt signals

K
Kastuś, 2018-10-06
@Gytim

In general, you can’t figure out what you need
def __init__(self):
super().__init__()
...
self.saveButton. clicked.connect(self.saveThis)
def saveThis(self):
print("Click")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question