You are not logged in.

halils70

Beginner

  • "halils70" is male
  • "halils70" started this thread

Posts: 1

Location: Istanbul

Occupation: IT Security Consultant & Project Manager

  • Send private message

1

Saturday, January 28th 2017, 9:38pm

PyQt5 slot&signal problem

Hi,
I am getting below error message with the code, please help me.
Thanks in advance.
Halil

Traceback (most recent call last):
File "/home/hsa/Belgeler/dev_python/qttest_1.py", line 31, in <module>

window = MyApp()
File "/home/hsa/Belgeler/dev_python/qttest_1.py", line 20, in __init__
self.editingFinished.connect(self.CalculateTax)
AttributeError: 'MyApp' object has no attribute 'editingFinished'

[Finished in 0.547s]

import sys
from PyQt5 import QtCore, QtGui, uic, QtWidgets
from PyQt5.QtCore import QObject, pyqtSignal

qtCreatorFile = "/home/hsa/Belgeler/dev_python/testgui1.ui" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)

class MyApp(QtWidgets.QMainWindow, Ui_MainWindow, QObject):
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.editingFinished.connect(self.CalculateTax)
def CalculateTax(self):
iskonta = int(self.LineEdit_3.toPlainText())
tutar = int(self.LineEdit_4.toPlainText())
toplam = iskonta/100*tutar
total_string = str(toplam)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = MyApp()
window.show()
sys.exit(app.exec_())