Найти - Пользователи
Полная версия: Получение данных из формы.
Начало » Python для новичков » Получение данных из формы.
1
Iamweb
Всем привет, подскажите, как получить данные из формы QLinеЕdit(), точнее какими методами?
FishHook
import sys
from PyQt4 import QtGui, Qt
class MainWindow(QtGui.QWidget):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.initialize_component()
    def initialize_component(self):
        self.setWindowTitle("Example")
        self.editor = QtGui.QLineEdit()
        button = QtGui.QPushButton("Click me!")
        button.clicked.connect(self.button_clicked)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.editor)
        layout.addWidget(button)
        self.setLayout(layout)
        self.setGeometry(300, 300, 300, 150)
        self.show()
    def  button_clicked(self, *args):
       mb = QtGui.QMessageBox.information(self, 'Message', self.editor.text())
def main():
    app = QtGui.QApplication(sys.argv)
    mw = MainWindow()
    sys.exit(app.exec_())
if __name__ == '__main__':
    main()
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB