Hii
I am have suffering few problems in doing following assignment , please help me...

Qtprogram using python to calculate addition, subtraction.

please help me ...i am new python

Small example (Qt Python program):

# -*- coding: utf-8 -*-

import sys

#Import the PyQt4 modules. Exit if not found.
try:
  from PyQt4.Qt import *
  from PyQt4.QtCore import *
  from PyQt4.QtGui import *
except:
  print "Failed to load QT libraries. Please intall PyQt4 first."
  sys.exit(1)

class Calculate(QMainWindow):
  def __init__(self):
    QMainWindow.__init__(self)
    
    self.textEdit = QLineEdit(self)
    self.textEdit.setDisabled(True)
    self.textEdit.setGeometry(QRect(10,10,235,40))
    self.textEdit.setObjectName("textEdit")
    self.textEdit.setText("0")
   
    self.button = QPushButton(self)
    self.button.setText("3")
    self.button.setGeometry(QRect(200, 55, 45, 60))
    self.connect(self.button, SIGNAL("clicked()"), self.button_clicked)
       
    self.textEdit.setAutoFillBackground(True)
    self.textEdit.setAlignment(Qt.AlignRight)
    
    self.setMinimumSize(QSize(255, 245))
    self.setMaximumSize(QSize(255, 245))
    
  def button_clicked(self):
    print "3"
    
if __name__ == "__main__":
    app = QApplication(sys.argv)
    f = Calculate()
    f.setWindowTitle("Calculate")
    f.show()
    sys.exit(app.exec_())

http://zetcode.com/tutorials/pyqt4/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.