I used the following code to create an OpenCV window with a back button:
cv2.namedWindow("Edit") cv2.createButton(\'Back\',self.back,None,cv2.QT_PUS