I have created a simple PyQt5 User Interface that looks like this:
import sys
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QLineEdit
class App(QWidget):
def __init__(self):
super().__init__()
self.title = 'Test'
self.left = 10
self.top = 10
self.width = 400
self.height = 500
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
# Create textbox
self.textbox = QLineEdit(self)
self.textbox.move(20, 100)
self.textbox.resize(280,40)
# Create textbox
self.textbox = QLineEdit(self)
self.textbox.move(20, 200)
self.textbox.resize(280,40)
# Create a button in the window
self.button = QPushButton('Run', self)
self.button.move(300, 99)
# Create a button in the window
self.button = QPushButton('Run', self)
self.button.move(300, 199)
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
sys.exit(app.exec_())
What I am trying to do is:
1) The user writes a string in the "textbox".
2) Clicks the run button.
3) The run button pushes the string to another variable (let's say "x='whatevertheuserinputs'", which is stored in another python file.
Can anyone give me any hint on how to approach the problem?
Thanks so much in advance!