Created
May 19, 2017 06:59
-
-
Save animeshsrivastava24/b321614c3b52585b75817bce05c5015c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from array import array | |
from Tkinter import * | |
import cv2 | |
from PIL import Image, ImageTk | |
width, height = 800, 600 | |
cap = cv2.VideoCapture(x) | |
root =Tk() | |
lmain =Label(root) | |
lmain.pack() | |
#Show Video Feed | |
def show_frame(): | |
menubar = Menu(root) | |
filemenu = Menu(menubar, tearoff=0) | |
filemenu.add_command(label="Exit", command=root.quit) | |
menubar.add_cascade(label="File", menu=filemenu) | |
_, frame = cap.read() | |
frame = cv2.flip(frame, 1) | |
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) | |
img = Image.fromarray(cv2image) | |
imgtk = ImageTk.PhotoImage(image=img) | |
lmain.imgtk = imgtk | |
lmain.configure(image=imgtk) | |
lmain.after(10, show_frame) | |
root = Tk() | |
menubar = Menu(root) | |
filemenu = Menu(menubar, tearoff=0) | |
filemenu.add_command(label="Exit", command=root.quit) | |
menubar.add_cascade(label="File", menu=filemenu) | |
editmenu = Menu(menubar, tearoff=0) | |
editmenu.add_command(label="Setting", command=show_frame) | |
menubar.add_cascade(label="Edit", menu=editmenu) | |
aboutmenu = Menu(menubar, tearoff=0) | |
aboutmenu.add_command(label="Help") | |
menubar.add_cascade(label="About", menu=aboutmenu) | |
root.config(menu=menubar) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to develop a label widget that will help me to select available camera list , please help.