import pyautogui
import PySimpleGUI as sg
import cv2
import numpy
def main():
sg.theme('White')
layout=[[sg.Text('Camera',size=(40,1),justification='center',font='Helvetica 20')],
[sg.Image(filename='',key='image')],
[sg.Button('Record',size=(10,1),font='Arial 14'),
sg.Button('Stop',size=(10,1),font='Arial 14'),
sg.Button('Exit',size=(10,1),font='Arial 14'),
sg.Button('Screenshot',size=(10,1),font='Arial 14')]]
window=sg.Window('Camera application',layout,location=(800,400))
cap=cv2.VideoCapture(0)
recording=False
while True:
event,values=window.read(timeout=20)
if event=='Exit' or event==sg.WIN_CLOSED:
return
elif event=='Record':
recording=True
elif event=='Screenshot':
myScreenshot=pyautogui.screenshot()
myScreenshot.save(r'shot.png')
elif event=='Stop':
recording=False
img=np.full((480,640),255)
imgbytes=cv2.imencode('.png',img)[1].tobytes()
window['image'].update(data=imgbytes)
if recording:
ret,frame=cap.read()
imgbytes=cv2.imencode('.png',frame)[1].tobytes()
window['image'].update(data=imgbytes)
main()
import PySimpleGUI as sg
import cv2
import numpy
def main():
sg.theme('White')
layout=[[sg.Text('Camera',size=(40,1),justification='center',font='Helvetica 20')],
[sg.Image(filename='',key='image')],
[sg.Button('Record',size=(10,1),font='Arial 14'),
sg.Button('Stop',size=(10,1),font='Arial 14'),
sg.Button('Exit',size=(10,1),font='Arial 14'),
sg.Button('Screenshot',size=(10,1),font='Arial 14')]]
window=sg.Window('Camera application',layout,location=(800,400))
cap=cv2.VideoCapture(0)
recording=False
while True:
event,values=window.read(timeout=20)
if event=='Exit' or event==sg.WIN_CLOSED:
return
elif event=='Record':
recording=True
elif event=='Screenshot':
myScreenshot=pyautogui.screenshot()
myScreenshot.save(r'shot.png')
elif event=='Stop':
recording=False
img=np.full((480,640),255)
imgbytes=cv2.imencode('.png',img)[1].tobytes()
window['image'].update(data=imgbytes)
if recording:
ret,frame=cap.read()
imgbytes=cv2.imencode('.png',frame)[1].tobytes()
window['image'].update(data=imgbytes)
main()
Among these Distributions which one doesn't comes from Linux Distributions background?
Anonymous Quiz
23%
Fedora
56%
Chrome OS
22%
Parrot OS
🌟Massive Update: Golden Opportunity to earn money by using python skills.If you're good at python programming and Frameworks.I will share my future projects with you.And help you to earn money.
🌟Project details will be uploaded only on Telegram group
🌟More details will be on next video
🌟Project details will be uploaded only on Telegram group
🌟More details will be on next video
import yagmail
receiver = "reciever email"
message = ("Hello there from Yagmai",'Test1.pdf')
sender = yagmail.SMTP("sender email")
sender.send(
to=receiver,
subject="Yagmail test with attachment",
contents=message
)
receiver = "reciever email"
message = ("Hello there from Yagmai",'Test1.pdf')
sender = yagmail.SMTP("sender email")
sender.send(
to=receiver,
subject="Yagmail test with attachment",
contents=message
)