vizier87
29th September 2017, 11:07
Hi guys,
I'm just trying to access my string from the textbox but my poor understanding of the python structure has made me quite frustrated.
Here's the code:
import sys
import time
from PyQt4.Qt import *
from PyQt4 import QtGui, QtCore
def CheckText(self):
print(textbox.self.text)
def info(self):
label.setText("Information here")
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.resize(600,400)
window.setWindowTitle("Test")
label = QtGui.QLabel("Status Text", window)
label.move(260,230)
label.resize(500,50)
textbox = QLineEdit(window)
textbox.move(30, 45)
textbox.resize(220,30)
btn_Enter = QtGui.QPushButton("Enter", window)
btn_Enter.move(30,80)
btn_Enter.resize(150,50)
btn_Enter.clicked.connect(lambda: CheckText(window))
window.show()
sys.exit(app.exec_())
The reason I'm using the code structure as above is because it allows me to edit the labels much easier but now I can't access the textbox string for comparing purposes. Anybody can help with me out?\
Thanks!
Vizier87
I'm just trying to access my string from the textbox but my poor understanding of the python structure has made me quite frustrated.
Here's the code:
import sys
import time
from PyQt4.Qt import *
from PyQt4 import QtGui, QtCore
def CheckText(self):
print(textbox.self.text)
def info(self):
label.setText("Information here")
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.resize(600,400)
window.setWindowTitle("Test")
label = QtGui.QLabel("Status Text", window)
label.move(260,230)
label.resize(500,50)
textbox = QLineEdit(window)
textbox.move(30, 45)
textbox.resize(220,30)
btn_Enter = QtGui.QPushButton("Enter", window)
btn_Enter.move(30,80)
btn_Enter.resize(150,50)
btn_Enter.clicked.connect(lambda: CheckText(window))
window.show()
sys.exit(app.exec_())
The reason I'm using the code structure as above is because it allows me to edit the labels much easier but now I can't access the textbox string for comparing purposes. Anybody can help with me out?\
Thanks!
Vizier87