0

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

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by -ordi-
0

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/

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.