Nov-10-2017, 10:45 PM
I would like the QLineEdit field to follow the label.
Right now the label lives in the upper left hand corner of the dialogue box.
Right now the label lives in the upper left hand corner of the dialogue box.
""" Import block """ from PyQt4 import QtCore from PyQt4 import QtGui """ Classes block """ class UI_central(QtGui.QDialog): def __init__(self, parent=None): super(UI_central, self).__init__(parent) label1 = QtGui.QLabel('Stock', self) self.line_edit = QtGui.QLineEdit() self.line_edit.setText("Starting...") hbox = QtGui.QHBoxLayout() hbox.addWidget(self.line_edit) self.setLayout(hbox) submit_button = QtGui.QPushButton("Submit") clear_button = QtGui.QPushButton("Clear") hbox.addWidget(submit_button) hbox.addWidget(clear_button) self.connect(submit_button, QtCore.SIGNAL("clicked()"), self.submit) self.connect(clear_button, QtCore.SIGNAL("clicked()"), self.clear) return def submit(self): str = self.line_edit.text() print(str) def clear(self): print ("cleared") self.line_edit.setText("")