All pastes #468030 Raw Edit

wipindon

public python v1 · immutable
·published 2007-05-02 21:04 UTC
rendered paste body
import sysfrom PyQt4 import QtCore, QtGuifrom frmAlgo import Ui_frmAlgoclass dlgAlgo(QtGui.QDialog):    def __init__(self):        QtGui.QDialog.__init__(self)        #Inicializar el formulario        self.ui = Ui_frmAlgo()        self.ui.setupUi(self)        # Conectar los botones con funciones del dialogo.        self.connect(self.ui.btnSumar, QtCore.SIGNAL("clicked()"),self.suma)        self.connect(self.ui.btnRestar, QtCore.SIGNAL("clicked()"),self.resta)    def suma(self):        a = int(self.ui.txtOperando1.text())        b = int(self.ui.txtOperando2.text())        c = a + b        self.ui.txtResultado.setText(str(c))    def resta(self):        a = int(self.ui.txtOperando1.text())        b = int(self.ui.txtOperando2.text())        c = a - b        self.ui.txtResultado.setText(str(c))