Professional Documents
Culture Documents
SCHOOL NOIDA
Session: 2022-23
COMPUTER SCIENCE (083) PROJECT
Certificate
The original research work was carried out by him/her under the supervision of
Mr/Ms Rakhi Garg in the academic year 2022-23. On the basis of the declaration
made by him, I recommend this project report for evaluation.
ACKNOWLEDGEMENT
Firstly, we would like to thank my teacher (Rakhi Garg) because she always supported and guided me
while doing this project. She very well cleared all the doubts we had regarding project. Also, I would
like to especially thank my parents and friends who helped me a lot.
The journey of making this project file has been beautiful, as well as knowledgeable for me and I have
learned a lot from it.
Once again, thanks to everyone who was involved with this project from beginning to end.
Roll No: 07
Index
1 Certificate
2 Acknowledgement
3 Introduction
4 System Requirements
5 Salient Features
6 Code
7 Output
8 Scope of Improvement
9 Bibliography
Introduction
RAM: 4 GB
import PIL
from PIL import *
import tkinter as tk
from tkinter import colorchooser,filedialog,ttk
import cv2
root = tk.Tk()
notebook = ttk.Notebook(root)
root.geometry("800x600")
width, height = 800, 600
x_offset = (root.winfo_screenwidth() - width) / 2
y_offset = (root.winfo_screenheight() - height) / 2
root.geometry("%dx%d+%d+%d" % (width, height, x_offset, y_offset))
frame_buttons = tk.Frame(root)
frame_buttons.grid(row=1, column=0)
def clear_canvas():
canvas.delete("all")
def set_eraser():
global brush_color
brush_color = eraser_color
def set_brush_size(size):
global brush_size
brush_size = int(size)
def paint(event):
x1, y1 = (event.x - brush_size), (event.y - brush_size)
x2, y2 = (event.x + brush_size), (event.y + brush_size)
canvas.create_oval(x1, y1, x2, y2, fill=brush_color, outline=brush_color)
eraser_button.grid(row=2, column=2)
brush_size_scale.grid(row=2, column=3)
brush_color_button.grid(row=2, column=1)
clear_button.grid(row=2, column=5)
shape_var = tk.StringVar(root)
shape_var.set("Select a Shape")
shape_dropdown = tk.OptionMenu(frame1, shape_var, "Oval",'Rectangle','Triangle')
shape_dropdown.grid(row=2, column=4)
def draw_shape(event):
shape = shape_var.get()
if shape == "Rectangle":
x1, y1 = (event.x - 40), (event.y - 40)
x2, y2 = (event.x + 40), (event.y + 40)
canvas.create_rectangle(x1, y1, x2, y2, outline=brush_color)
elif shape == "Oval":
x1, y1 = (event.x - 40), (event.y - 40)
x2, y2 = (event.x + 40), (event.y + 40)
canvas.create_oval(x1, y1, x2, y2, outline=brush_color)
elif shape == "Triangle":
x1, y1 = (event.x - 40), (event.y - 40)
x2, y2 = (event.x + 40), (event.y - 40)
x3, y3 = (event.x), (event.y + 40)
canvas.create_polygon(x1, y1, x2, y2, x3, y3,outline=brush_color)
canvas.bind("<Button-1>", draw_shape)
def record_canvas():
# Get the current state of the canvas as an image
# Get the location of the canvas
x = root.winfo_rootx() + canvas.winfo_x()
y = root.winfo_rooty() + canvas.winfo_y()
width = canvas.winfo_width()
height = canvas.winfo_height()
# Start recording
while True:
img = cv2.GetWindowImage(screen)
out.write(img)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
root.mainloop()
Output
Scope of Improvement