I need to take what number is typed into a QLineEdit object and assign it to a variable x when the enter key is pressed. How can I do this with the new signals and slots mechanism that was implemented in Qt 4.5 ?
import sys
from PyQt4 import QtGui
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
data1 = QtGui.QLineEdit('', self)
data1.move(10, 13)
self.setGeometry(300, 300, 250, 45)
self.setWindowTitle('Absolute')
self.show()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()