Advertisement
JohnMandrake

Untitled

Feb 6th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import sys
  4. from PyQt4 import QtGui
  5.  
  6. class Example(QtGui.QWidget):
  7.     def __init__(self):
  8.         super(Example, self).__init__()
  9.  
  10.         self.initUI()
  11.        
  12.     def initUI(self):
  13.         self.btn = QtGui.QPushButton('OK', self)
  14.         self.btn.move(20, 20)
  15.         self.btn.clicked.connect(self.showDialog)
  16.         self.le = QtGui.QLineEdit(self)
  17.         self.le.move(130, 22)
  18.         self.setGeometry(300, 300, 290, 150)
  19.         self.setWindowTitle('Input dialog')
  20.         self.show()
  21.     def showDialog(self):
  22.         text, ok = QtGui.QInputDialog.getText(self, 'Input Dialog',
  23.         'Podaj slowo:')
  24.         if ok:
  25.             self.le.setText(str(text))
  26. def main():
  27.     app = QtGui.QApplication(sys.argv)
  28.     ex = Example()
  29.     sys.exit(app.exec_())
  30. if __name__ == '__main__':
  31.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement