connect two mathod to the same button in pyq5 code example
Example 1: connect two mathod to the same button in pyq5
self.trainPreproBtn.clicked.connect(self.connectionFunction)
@pyqtSlot()
def connectionFunction(self):
self.firstFunction()
self.secondFunction()
Example 2: connect two mathod to the same button in pyq5
self.trainPreproBtn.clicked.connect(self.preproClicked, self.thresClicked)
@pyqtSlot()
def preproClicked(self):
gray = cv2.cvtColor(self.image, cv2.IMREAD_COLOR)
self.image = cv2.cvtColor(gray,cv2.COLOR_BGR2GRAY)
#(thresh, im_bw) = cv2.threshold(self.image, 128, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
#resize_image = cv2.resize(im_bw, (180, 180))
self.displayImage(2)
@pyqtSlot()
def thresClicked(self):
gray = cv2.cvtColor(self.image, cv2.IMREAD_COLOR)
self.image = cv2.cvtColor(gray, cv2.COLOR_BGR2GRAY)
self.image = cv2.threshold(self.image, 128, 255, cv2.THRESH_BINARY )
self.displayImage(4)