Share Pastebin
Guest
Public paste!

pyqt4

By: a guest | Jan 26th, 2010 | Syntax: Python | Size: 1.47 KB | Hits: 98 | Expires: Never
Copy text to clipboard
  1. #!/usr/bin/python
  2.  
  3. # inputdialog.py
  4.  
  5. import sys
  6. from PyQt4 import QtGui
  7. from PyQt4 import QtCore
  8.  
  9.  
  10. class InputDialog(QtGui.QWidget):
  11.     def __init__(self, parent=None):
  12.         QtGui.QWidget.__init__(self, parent)
  13.         self.currentResult = FuzzNumber()
  14.  
  15.         self.setWindowTitle('Fuzzy stuff')
  16.  
  17.         self.layout = QtGui.QGridLayout()
  18.  
  19.         self.addButtons()
  20.  
  21.         #self.button = QtGui.QPushButton('Calculate', self)
  22.         #self.layout.addWidget( self.button )
  23.  
  24.         self.resultLabel = QtGui.QLabel(self)
  25.  
  26.         self.lineedit = QtGui.QLineEdit(self)
  27.         self.layout.addWidget( self.resultLabel, 0, 1, 1, 2 )
  28.         self.layout.addWidget( self.lineedit, 1, 1, 1, 2 )
  29.         self.connect(self.additionButton, QtCore.SIGNAL('clicked()'), self.add)
  30.  
  31.         self.setLayout( self.layout )
  32.  
  33.     def addButtons(self):
  34.         self.additionButton = QtGui.QPushButton('+', self)
  35.         self.layout.addWidget( self.additionButton, 2, 1 )
  36.  
  37.         self.multiplicationButton = QtGui.QPushButton('*', self)
  38.         self.layout.addWidget( self.multiplicationButton, 2, 2 )
  39.  
  40.     def add(self):
  41.         # func()
  42.         CONNECT
  43.         self.currentResult = self.currentResult() + FuzzNumber( self.lineedit.getInte )
  44.         self.resultLabel.setText( self.lineedit.text() + self.resultLabel.text() )
  45.         self.lineedit.clear()
  46.         self.resultLabel.show()
  47.  
  48.  
  49. app = QtGui.QApplication(sys.argv)
  50. icon = InputDialog()
  51. icon.show()
  52. app.exec_()