Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #connect #mathod #button
ADD COMMENT
Topic
Name
1+3 =