-
Notifications
You must be signed in to change notification settings - Fork 0
/
Screen_Recorder.py
82 lines (67 loc) · 1.84 KB
/
Screen_Recorder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from tkinter import *
from tkinter import ttk
from tkinter.messagebox import askyesno
import cv2
import numpy as np
import pyautogui
import keyboard
import time
flag = True
def printtext():
global e
string = e.get()
global out
out = cv2.VideoWriter("string.avi", fourcc, 10.0, (SCREEN_SIZE))
def stoprecord():
print("stoprecord")
global flag
flag = False
out.release()
def continuerecord():
if flag:
print("recording")
img = pyautogui.screenshot()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
root.after(20,continuerecord)
def startrecord():
print("startrecord")
global flag
flag = True
continuerecord()
def close():
print("close")
cv2.destroyAllWindows()
root.quit
##
SCREEN_SIZE = (1920, 1080)
fourcc = cv2.VideoWriter_fourcc('M','J','P','G')
root = Tk()
root.title('Screen Recorder')
frame1 = Frame(root)
frame1.config(width = 100,bd = 5)
frame1.pack()
frame2 = Frame(root,width = 2500,bd = 5)
frame2.pack()
frame3 = Frame(root, width = 100,bd = 5)
frame3.pack()
frame4 = Frame(root, width = 250,bd = 5)
frame4.pack()
l = Label(frame1 , text = 'File Name')
l.pack()
e = Entry(frame1)
e.pack()
e.focus_set()
b = Button(frame1,text='save file name',command=printtext)
b.pack(side='bottom')
b0 = Button(frame2,text='stop recording',command=stoprecord)
b0.pack(side='right')
b1 = Button(frame2,text='start recording',command=startrecord)
b1.pack(side='left')
be = Button(frame3,text='EXIT',fg='red',command=root.quit)
be.pack(side='bottom')
contactlabel = Message(frame4,text = 'developed by Shreyas \ncontact :incredibletech11@gmail.com')
contactlabel.config(width = 250)
contactlabel.pack(side = 'bottom')
root.mainloop()