App

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

import sys

from PyQt4 import QtCore, QtGui


from MainWindow import Ui_MainWindow

class App(QtGui.QMainWindow, Ui_MainWindow):

def __init__(self):
QtGui.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.value_x.setFocus()
self.connect(self.value_x,QtCore.SIGNAL('returnPressed()'),self.Calcular)
self.Calculate.clicked.connect(self.Calcular)

def Calcular(self):
a=float(self.value_a.toPlainText())
b=float(self.value_b.toPlainText())
x=float(self.value_x.text())
y=a*x+b
self.result_y.setText(str(y))

if __name__ == '__main__':
app=QtGui.QApplication(sys.argv)
window=App()
window.show()
sys.exit(app.exec_())

You might also like