Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import cv2 from tkinter import * from tkinter import ttk from abc import ABC, abstractmethod from collections.abc import MutableMapping import xlwt class Visualize: def __init__(self):

import cv2

from tkinter import *

from tkinter import ttk

from abc import ABC, abstractmethod

from collections.abc import MutableMapping

import xlwt

class Visualize:

def __init__(self):

self.root = Tk()

self.root.title("Storeroom Software")

self.frame = ttk.Frame(self.root, padding=10)

self.frame.grid()

self.capture_button = ttk.Button(self.frame, text="Capture", command=self.capture_video)

self.capture_button.grid(column=0, row=0)

self.image_button = ttk.Button(self.frame, text="Image", command=self.show_image)

self.image_button.grid(column=1, row=0)

self.root.mainloop()

def capture_video(self):

self.cap = cv2.VideoCapture(0)

while True:

ret, frame = self.cap.read()

cv2.imshow("Storeroom", frame)

if cv2.waitKey(1) == 27:

break

self.cap.release()

cv2.destroyAllWindows()

def show_image(self):

pass # TODO: Add code to show image of selected raw material/product photo

class RawMaterials(MutableMapping):

def __init__(self, *args, **kwargs):

self.store = dict()

self.update(dict(*args, **kwargs)) # use the free update to set keys

def __getitem__(self, key):

return self.store[self.__keytransform__(key)]

def __setitem__(self, key, value):

self.store[self.__keytransform__(key)] = value

def __delitem__(self, key):

del self.store[self.__keytransform__(key)]

def __iter__(self):

return iter(self.store)

def __len__(self):

return len(self.store)

def __keytransform__(self, key):

return key

class Products(RawMaterials):

def __init__(self, *args, **kwargs):

super().__init__(*args, **kwargs)

def __keytransform__(self, key):

return key.lower()

def save_to_excel(self, file_name):

workbook = xlwt.Workbook()

worksheet = workbook.add_sheet("Products")

row = 0

for key, value in self.items():

worksheet.write(row, 0, key)

for col, item in enumerate(value):

worksheet.write(row, col+1, item)

row += 1

workbook.save(file_name)

def load_from_excel(self, file_name):

pass # TODO: Add code to load raw materials and products from Excel file

visualize = Visualize()

raw_materials = RawMaterials()

raw_materials["RM1"] = ("Name", "Date of Purchase", "Name of Supplier", "Storage Expiration Date", "Storage Code", "Description")

raw_materials["RM2"] = ("Name", "Date of Purchase", "Name of Supplier", "Storage Expiration Date", "Storage Code", "Description")

raw_materials["RM3"] = ("Name", "Date of Purchase", "Name of Supplier", "Storage Expiration Date", "Storage Code", "Description")

raw_materials["RM4"] = ("Name", "Date of Purchase", "Name of Supplier", "Storage Expiration Date", "Storage Code", "Description")

raw_materials["RM5"] = ("Name", "Date of Purchase", "Name of Supplier", "Storage Expiration Date", "Storage Code", "Description")

products = Products()

products["Product1"] = ("Name", "Date of Production", "Name of Customer", "Product Expiration Date", "Storage Code", "List of Raw Material Codes", "Description")

products["Product2"] = ("Name", "Date of Production", "Name of Customer", "Product Expiration Date", "Storage Code", "List of Raw Material Codes", "Description")

products["Product3"] = ("Name", "Date of Production", "Name of Customer", "Product Expiration Date", "Storage Code", "List of Raw Material Codes", "Description")

products["Product4"] = ("Name", "Date of Production", "Name of Customer", "Product Expiration Date", "Storage Code", "List of Raw Material Codes", "Description")

products["Product5"] = ("Name", "Date of Production", "Name of Customer", "Product Expiration Date", "Storage Code", "List of Raw Material Codes", "Description")

products.save_to_excel("products.xls")

Using the Open CV and Tkinter libraries and Python, develop a simple storeroom software. The software should include the following items:

1. Write a class named Visualize .

2. An interface and a button (Considering the Visualize class) should be designed for capturing video from webcam (storeroom).

3. Write a class named RawMaterials

4. Write a class named Products

5. Products class should inherit the RawMaterials class

6. At least 5 raw material items (objects) should be given to the software with the following attributes:

Name

Date of purchase

Name of Supplier

Storage expiration date

Storage code

Description

7. At least 5 product items (objects) should be given to the software with the following attributes:

Name

Date of Production

Name of Customer

Product expiration date

Storage code

List of raw material codes that are used

Description

8. The raw material and product attributes should be able to be set and read using Setter and Getter methods.

9. Use abstract classes and methods to avoid unwanted access

10. Use polymorphism (overriding and overloading) to avoid more than necessary methods

11. The code should be extendable

12. Add only one button named Image (Considering the Visualize class) to show the image of the selected raw material/product photo.

13. The software should be able to save all attributes of the raw materials and products in an Excel file.

14. The software should be able to load all attributes of the raw materials and products in an Excel file.

15. You are supposed to submit the code and a report file as a zip file.

Bonus part:

The following items will be considered as bonus:

Application of database structures (like SQL) instead of Excel

Adding a Report Generation button for generating a report for raw materials and products considering their expiration and statistical information.

Designing the graphical user interface and menus in a professional and attractive format.

I found this code for this question in chegg but I couldn't write the TODO parts in the comment lines. This code just show the capture and image buttons but I want to open this like eimage text in transcribed

mProjects\pythonProject7 \ venv \Sc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

3. Training.

Answered: 1 week ago