I had this problem before with OpenCV. As far as I am aware there is no functionality for buttons in OpenCV.
However, I used Tkinter and created a canvas along with some buttons (in your case these will be start, stop, capture, close). Each frame that was captured using OpenCV I drew onto the Tkinter canvas.
I was using this for a frame by frame program, so I am not sure how well this method will perform in real time.
A very quick example code:
from Tkinter import *
import cv2.cv as cv
root = Tk()
w = Canvas(root, width=500, height=300, bd = 10, bg = 'white')
w.grid(row = 0, column = 0, columnspan = 2)
b = Button(width = 10, height = 2, text = 'Button1')
b.grid(row = 1, column = 0)
b2 = Button(width = 10, height = 2, text = 'Button2')
b2.grid(row = 1,column = 1)
cv.NamedWindow("camera",1)
capture = cv.CaptureFromCAM(0)
while True:
img = cv.QueryFrame(capture)
canvas.create_image(0,0, image=img)
if cv.WaitKey(10) == 27:
break
root.mainloop()
This may or may not work right off the bat as I am not in a position to test this right now. One potential change I can see would be the image format OpenCV uses. You may need to use one of the conversion functions to change the format.