Cube Code Rs
Cube Code Rs
INTRODUCTION
ABSTRACT:
EXISTING SYSTEM
Customers can reach support teams through phone, email, live chat, social media, and
helpdesk portals.
Knowledge bases, FAQs, and community forums help customers find answers
independently.
PROPOSED SYSTEM
The proposed Customer Support Framework using Python with a colorful GUI aims to
overcome these limitations by integrating advanced features:
SOFTWARE REQUIREMENTS
OS : Windows 10, Linux, or macOS
Python : 3.13
IDE : Pycharm
HARDWARE REQUIREMENTS
Processor : Intel Core i3
RAM : 4GB
DATAFLOW DIAGRAM
USERS
ADMIN ACTIONS
Id (PK)
Username (Unique) View Tickets
Password role Respond to Tickets
(Enum:customer, admin) Delete Tickets
1-to-Many(user_id) Manages
TICKETS
Id(PK)
User_id (FK->Users.id)
Subject
Message
Status(Enum: Open, In Progress, Resolved)
DATABASE DESIGN
1.Table: users
Stores user details (both customers and admins).
Example:
User Table(Stores user details)
id user name password role
1 Alice alice123 customer
2 Bob Bob123 admin
3 Charlie Charlie99 customer
PYTHON FEATURES:
Uses an elegant syntax, making the programs you write easier to read.
Is an easy-to-use language that makes it simple to get your program working.
This makes Python ideal for prototype development and other ad-hoc programming
tasks, without compromising maintainability.
Comes with a large standard library that supports many common programming
tasks such as connecting to web servers, searching text with regular expressions,
reading and modifying files.
Python's interactive mode makes it easy to test short snippets of code. Therealso a
bundled development environment called IDLE.
PYTHON CAREERS:
Game developer
Web designer
Python developer
Full-stack developer
Data scientist
Data analyst
CHARACTERISTICS OF PYTHON
PYTHON HISTORY
science research institute named Centrum Wiskunde & Informatica (CWI) in the
Netherlands. In 1991, Van Rossum conceived and published Python as a successor of
ABC language. For many uninitiated people, the word Python is related to a species of
snake. Rossum though attributes the choice of the name Python to a popular comedy
series "Monty Python's Flying Circus" on BBC. Being the principal architect of Python,
the developer community conferred upon him the title of "Benevolent Dictator for Life
(BDFL). However, in 2018, Rossum relinquished the title. Thereafter, the development
and distribution of the reference implementation of Python is handled by a nonprofit
organization Python Software Foundation. Important stages in the history of Python:
Python 0.9.0 Python's first published version is 0.9. It was released in February 1991. It
consisted of support for core object- oriented programming principles. Python 1.0 In
January 1994, version 1.0 was released, armed with functional programming tools,
features like support for complex numbers etc. Python 2.0 Next major version – Python
2.0 was launched in October 2000.
Many new features such as list comprehension, garbage collection and Unicode
support were included with it. Python 3.0 Python 3.0, a completely revamped version of
Python was released in December 2008. The primary objective of this revamp was to
remove a lot of discrepancies that had crept in Python 2.x versions. Python 3 was
backported to Python 2.6. It also included a utility named as python2to3 to facilitate
automatic translation of Python 2 code to Python 3. EOL for Python 2.x Even after the
release of Python 3, Python Software Foundation continued to support the Python 2
branch with incremental micro versions till 2019. However, it decided to discontinue the
support by the end of year 2020, at which time Python 2.7.17 was the last version in the
branch.
PYTHON 3.11:
One of the most important features of Python's version 3.11 is the significant
improvement in speed. According to Python's official documentation, this version is
faster than the previous version (3.10) by up to 60%. It also states that the standard
benchmark suite shows a 25% faster execution rate.
Python 3.11 has a better exception messaging. Instead of generating a long
traceback on the occurrence of an exception, we now get the exact expression
causing the error.
As per the recommendations of PEP 678, the add_note() method is added to
the BaseException class. You can call this method inside the except clause and
pass a custom error message.
It also adds the cbroot() function in the maths module. It returns the cube root
of a given
number.
A new module tomllib is added in the standard library. TOML (Tom's Obvious
Minimal Language) can be parsed with tomlib module function.
PYTHON IDE’s:
Jupyter Notebook
Spyder
Spyder is an open-source Python IDE that was originally created and developed
by Pierre Raybaut in 2009. It can be integrated with many different Python packages such
as NumPy, SymPy, SciPy, pandas, IPython, etc. The Spyder editor also supports code
introspection, code completion, syntax highlighting, horizontal and vertical splitting,
etc. It is considered one of the best Python IDEs for data science field.
Sublime text
Sublime text is a proprietary code editor and it supports a Python API. Some of
the features of Sublime Text are project-specific preferences, quick navigation,
supportive plugins for cross-platform, etc. While the Sublime text is quite fast and has a
good support group, it is not available for free. Perhaps a lot of good features are
available as well, and you can build a basic project in it.
For more advance and complex loaded features, you have to take its premium
subscription. Also, it is one of the best choices among Data Scientists.
Pycharm
Pycharm is a Python IDE developed by JetBrains and created specifically for
Python. It has various features such as code analysis, integrated unit tester, integrated
Python debugger, support for web frameworks, etc. Pycharm is particularly useful in
machine learning because it supports libraries such as Pandas, Matplotlib.
Rodeo
Rodeo is an open-source IDE that was developed by Yhat for data science
in Python. So Rodeo includes Python tutorials and also cheat sheets that can be used for
reference if required. Some of the features of Rodeo are syntax highlighting, auto-
completion, easy interaction with data frames and plots, built-in IPython support, etc.
Thonny:
Thonny is a Python IDE that was developed at The University of Tartu for Python.
It is created for beginners that are learning to program in Python or for those that are
teaching it. Some of the features of Thonny are statement stepping without breakpoints,
simple pip GUI, line numbers, live variables during debugging,
Atom
Atom is an open-source text and code editor that was developed using
Electron.It has multiple features such as a sleek interface, a file system browser,
various extensions, etc. Atom also has an extension that can support Python while it is
running and work as a Python IDE
Geany
Geany is a free text editor that supports Python and contains IDE features as
well and it is considered as one of the best Python IDEs for data science. It was
originally authored by Enrico Troger in C and C++. Some of the features of Geany are
Symbol lists, Auto-completion, Syntax highlighting, Code navigation, Multiple
document support, etc.
PYTHON CLASSES AND OBJECTS
A class is a user-defined blueprint or prototype from which objects are created.
Classes provide a means of bundling data and functionality together. Creating a new
class creates a new type of object, allowing new instances of that type to be made.
Each class instance can have attributes attached to it for maintaining its state. Class
instances can also have methods (defined by their class) for modifying their state.
Syntax: Class Definition class ClassName:
# Statement
The class creates a user-defined data structure, which holds its own data members
and member functions, which can be accessed and used by creating an instance of that
class. A class is like a blueprint for an object.
init () method
The method init () is similar to constructors in Constructors are used to
initializing the object’s state. Like methods, a constructor also contains a collection of
statements (i.e. instructions) that are executed at the time of Object creation. It runs as
soon as an object of a class is instantiated.
str () method
Python has a particular method called str (). that is used to define
how a class object should be represented as a string. It is often used to give an object a
human- readable textual representation, which is helpful for logging, debugging, or
showing users object information. When a class object is used to create a string using
the built-in functions print() and str(), the str () function is automatically used.
CONSTRUCTORS IN PYTHON:
Constructors are generally used for instantiating an object. The task of
constructors is to initialize(assign values) to the data members of the class when an
object of the class is created. In Python the init () method is called the constructor
and is always called when an object is created.
Syntax of constructor declaration:
TYPES OF CONSTUCTORS:
default constructor:
The default constructor is a simple constructor which doesn‟t accept any
arguments. Its definition has only one argument which is a reference to the instance
being constructed.
parameterized constructor:
constructor with parameters is known as parameterized constructor. The
parameterized constructor takes its first argument as a reference to the instance being
constructed known as self and the rest of the arguments are provided by the
programmer.
Advantages of using constructors in Python:
Initialization of objects:
Constructors are used to initialize the objects of a class. They allow you to set default
values for attributes or properties, and also allow you to initialize the object with custom
data.
Easy to implement:
Constructors are easy to implement in Python, and can be defined
using the init () method. Better readability: Constructors improve the readability of
the code by making it clear what values are being initialized and how they are being
initialized.
Encapsulation:
# body of destructor
• Automatic cleanup:
Destructors are easy to implement in Python, and can be defined using the
del () method.
INHERITANCE IN PYTHON
Inheritance allows you to inherit the properties of a class, i.e., base class to
another, i.e., derived class.
Class BaseClass:
{Body}
Class DerivedClass(BaseClass):
{Body}
POLYMORPHISM IN PYTHON
In Python, Polymorphism lets us define methods in the child class that have
the same name as the methods in the parent class. In inheritance, the child class inherits
the methods from the parent class. However, it is possible to modify a method in a child
class that it has inherited from the parent class. This is particularly useful in cases where
the method inherited from the parent class doesn‟t quite fit the child class. In such
cases, we re- implement the method in the child class. This process of re-implementing
a method in the child class is known as Method Overriding.
Static variables are allocated memory once when the object for the class is
created for the first time.
Static variables are created outside of methods but inside a class
Static variables can be accessed through a class but not directly with an
instance.
Static variables behavior doesn‟t change for every object.
Static variables can be useful for maintaining state across all instances of a class,
or for sharing data among all instances of a class. However, it‟s important to use them
carefully and to ensure that their values are synchronized with the state of the
program, especially in a multithreaded environment.
Advantages:
Memory efficiency:
Since static variables are shared among all instances of a class, they can
save memory by avoiding the need to create multiple copies of the same data.
Shared state:
Static variables can provide a way to maintain shared state across all
instances of a class, allowing all instances to access and modify the same data.
Easy to access:
Static variables can be accessed using the class name itself, without needing
an instance of the class. This can make it more convenient to access and modify the
data stored in a static variable.
Initialization:
Static variables can be initialized when the class is defined, making it easy to
ensure that the variable has a valid starting value.
Readability:
Static variables can improve the readability of the code, as they clearly
indicate that the data stored in the variable is shared among all instances of the class.
Disadvantages:
Inflexibility:
Static variables can be inflexible, as their values are shared across all
instances of the class, making it difficult to have different values for different
instances.
Hidden dependencies:
Static variables can add to the namespace of the class, potentially causing
name conflicts and making it harder to maintain the code.
Testing:
Static variables can make it more difficult to write effective unit tests,
as the state of the static variable may affect the behavior of the class and its
methods. Overall, static variables can be a useful tool in Python programming,
but they should be used with care and attention to potential downsides, such as
inflexibility, hidden dependencies, and thread safety concerns.
METAPROGRAMMING WITH METACLASSES IN PYTHON
The metaclass is responsible for the generation of classes, so we can write
our custom metaclasses to modify the way classes are generated by performing extra
actions or injecting code. Usually, we do not need custom metaclasses but sometimes
it‟s necessary. There are problems for which metaclass and non-metaclass-based
solutions are available (which are often simpler) but in some cases, only metaclass.
Creating custom Metaclass
To create our custom meta class, our custom meta class has to inherit
type meta class and usually override –
new ():
It‟s a method which is called before init (). It creates the object and returns
it.
We can override this method to control how the objects are created.
init ():
This method just initialize the created object passed as a parameter .We can
create
1. When called with only one argument, it returns the type. We have seen it
before in the above examples.
2. When called with three parameters, it creates a class. Following arguments are
passed to it
3. Class name
4. Tuple having base classes inherited by class
5. Class Dictionary: It serves as a local namespace for the class, populated with class
methods and variable
PYTHON EXCEPTION HANDLING:
Error in Python can be of two types. Errors are problems in a program due to which
the program will stop the execution. On the other hand, exceptions are raised when
some internal events occur which change the normal flow of the program.
In Python, there are several built-in Python exceptions that can be raised when an
error occurs during the execution of a program. Here are some of the most common
types of exceptions in Python:
Syntax Error:
This exception is raised when the interpreter encounters a syntax error in the
code, such as a misspelled keyword, a missing colon, or an unbalanced parenthesis.
Type Error:
This exception is raised when a variable or function name is not found in the
current scope.
Index Error:
This exception is raised when an index is out of range for a list, tuple, or
other sequence types.
Key Error:
Value Error:
Attribute Error
This exception is raised when an attribute or method is not found on an
object, such as trying to access a non-existent attribute of a class instance.
Exception handling allows you to separate error handling code from the
main program logic, making it easier to read and maintain your code.
Cleaner code:
Performance overhead:
Exception handling can make your code more complex, especially if you
have to handle multiple types of exceptions or implement complex error handling
logic.
Possible security risks:
PYTHON FUNCTIONS
Python Functions is a block of statements that return the specific task. The idea
is to put some commonly or repeatedly done tasks together and make a function
so that instead of writing the same code again and again for different inputs, we
can do the function calls to reuse code contained in it over and over again.
Ease of use
Generators in Python
keyword.In this article, we will discuss how the generator function works in python.
Generator Function in Python
In Python, we can create a generator function by simply using the def keyword and
the yield keyword. The generator has the following
syntax
def function_name():
Generator Object
Python Generator functions return a generator object that is iterable, i.e., can be used
as an Generator objects are used either by calling the next method of the generator object
or using the generator object in a “for in” loop.
Python Generator Expression
In Python, generator expression is another way of writing the generator function. It uses
the Python technique but instead of storing the elements in a list in memory, it creates
generator objects.
Generator Expression Syntax
The generator expression in Python has the following Syntax: (expression for item in
iterable)
PYTHON LAMBDA
This function can have any number of arguments but only one expression,
which is evaluated and returned.
One is free to use lambda functions wherever function objects are required.
You need to keep in your knowledge that lambda functions are syntactically
restricted to a single expression.
It has various uses in particular fields of programming, besides other
types of expressions in functions.
Python input() Function
Python input() function is used to take user input. By default, it returns the
user input in form of a string.
input() Function
Syntax:
input(prompt)
Python list() function takes any iterable as a parameter and returns a list.
In Python iterable is the object you can iterate over.
Syntax: list(iterable)
Parameter:
iterable:
which includes peoples nationality, sex, age, and name. Suppose if we want to
analyze the relationship between nationality and handedness of the peoples. Crosstab
. gives you the relationship between them
Correlation in Python
straight line, thus, the linear association is stronger. The closer r is to 0, making
the linear association weaker.
Selenium is a powerful tool for automating interactions with web applications. It allows
us to script actions that a user would typically perform on a website, such as clicking
buttons, filling out forms, and navigating through web pages
3. Requests
Automation using the requests library in Python is typically used for making HTTP
requests to interact with web services, APIs, or websites programmatically. You can send
various types of HTTP requests, such as GET, POST, PUT, DELETE, etc. Once you
send a request, you can handle the response, which includes the status code, headers, and
content.
4. Beautiful Soup
Automation using BeautifulSoup is typically used for web scraping tasks. BeautifulSoup
is a Python library that makes it easy to extract data from HTML and XML documents.
We can use Use BeautifulSoup‟s methods to locate and extract specific elements
from the HTML document.
5. Pandas
This package provides all the necessary tools for working with JSON Objects
including parsing, deserializing, and many more.
TESTING IN PYTHON
Test Runner is a library or a testing tool which reads the source code that contains unit
tests and a bunch of settings which can be executed and produces its output to the
console or log files. There are different Test Runners available in Python. Popular one
are
Unit test
nose or nose2
pytest
unit test :
It is built into the standard python library. import unit test should be the
starting line of code for using it. Depends upon the python version, it should differ as
later versions of Python supports unit test and earlier versions supported unittest2.
nose or nose2:
This is an open source application and similar to unit test only.It is compatible
with numerous kinds of tests that are written using unit test framework. nose2 is
the recent version one, and they are installed by using.
pytest:
It supports unit test test cases execution. It has benefits like supporting built in
assert statement, filtering of test cases, returning from last failing test etc
How to Structure a Simple Test:
1. For writing a test, need to know what is going to get tested.
2. Does it cover unit testing and/or integration testing?
3. All kind of necessary inputs (it can range between integer, float, type data types
etc., ) and the code for their execution and get the output and compare the
output with expected result.
How to Write Assertions:
Assertion is nothing but validating the output against a known response. i.e.
in above code, we have passed the list containing 3 values namely 10, 20 and 30,
and we know that its multiplication result is 6000. So as a last step in code, we will be
writing assertion code and above code comes up with assert Equal and surely it will
give the output as 6000 and hence the test case passes.
pytest:
It supports unit test test cases execution. It has benefits like supporting built in
assert statement, filtering of test cases, returning from last failing test etc
How to Structure a Simple Test:
1. For writing a test, need to know what is going to get tested.
2. Does it cover unit testing and/or integration testing?
3. All kind of necessary inputs (it can range between integer, float, type data
types etc., ) and the code for their execution and get the output and
compare the output with expected result.
How to Write Assertions:
Assertion is nothing but validating the output against a known response. i.e.
in above code, we have passed the list containing 3 values namely 10, 20 and 30,
and we know that its multiplication result is 6000. So as a last step in code, we will be
writing assertion code and above code comes up with assert Equal and surely it will
give the output as 6000 and hence the test case passes.
RUNNING TESTS FROM PYCHARM:
1. First from project tool window, select the tests directory
2. Then, on the context menu, choose “Unit Tests in” or “PyTests in“ For individual
test,
Via main toolbar by using Run or Debug command
Via context menu by using Run or Debug by clicking the specific file
Testing for Web Frameworks Like Django and Flask:
Based on unit test, Django and Flask makes things easier, and they have their
testing framework:
Django Test Runner:
The Django start app template will have created a tests.py file inside your
application directory. If you don’t have that already, you can create it with the
following contents.
INTRODUCTION TO SQLITE
SQLite is an in-process library that implements a self-contained, serverless,
zero- configuration, transactional SQL database engine. It is a popular choice as an
embedded database for local/client storage in application software such as web
browsers. It is also used in many other applications that need a lightweight, embedded
database.
SQLite is ACID-compliant and implements most of the SQL standards,
using a dynamically and weakly typed SQL syntax that does not guarantee domain
integrity.
To use SQLite in a C/C++ program, you can use the sqlite3 API, which provides
a lightweight, simple, self-contained, high-reliability, full-featured, and SQL database
engine. The API is implemented as a library of C functions that can be called from your
program. One of the main benefits of using SQLite is that it is very easy to get started
with.
SQLite History
SQLite was created in the year 2000 by D. Richard Hipp, who continues
to lead the development of the software today. SQLite was designed to be a lightweight
and simple database engine that could be easily embedded into other applications. It
was created as an alternative to more complex and heavyweight database engines, such
as MySQL and PostgreSQL. Over the years, SQLite has gained widespread adoption
and is now one of the most widely used database engines in the world. It is used in
many applications, including web browsers, mobile phones, and a wide variety of other
software.
Applications of SQLite
1. Due to its small code print and efficient usage of memory, it is the popular
choice for the database engine in cell phones, PDAs, MP3 players, set-top boxes,
and other electronic gadgets.
2. It is used as an alternative for open to writing XML, JSON, CSV, or some
proprietary format into disk files used by the application.
3. As it has no complication for configuration and easily stores file in an ordinary disk
file, so it can be used as a database for small to medium sized websites.
4. It is faster and accessible through a wide variety of third-party tools, so it has great
applications in different software platforms.
SQLite Commands
In SQLite, DDL (Data Definition Language) is used to create and modify
database objects such as tables, indices, and views. Some examples of DDL
statements in SQLite are:
SQLite has a relatively small set of data types compared to other database
engines. It does not support many of the more advanced data types, such as arrays
and JSON, that are available in other databases.
Limited scalability:
SQLite is not designed to be a high-concurrency, high-transaction-rate
database engine. It is more suited for use in smaller-scale, low-concurrency systems,
and may not be able to scale to handle very large amounts of data or very high levels
of concurrency.
Difference between MySQL and SQLite:
1. MySQL :
MySQL is an open-source relational database management system(RDBMS)
based on Structured Query Language (SQL). It is currently developed and managed
by Oracle Corporation, since acquisition by Sun Microsystems on 27 January 2010,
which had itself acquired MySQL in 2008. It was initially released internally on
23 may 1995 by David Axmark, Allan Larsson and Michael “Monty” Widenius
of MySQL AB from Sweden, though development for personal use by Widenius and
Axmark began in 1994. Since acquisition of Sun by Oracle, the original developers
left MySQL to work on a fork known as MariaDB. It is widely being used in many
small and large scale industrial applications and capable of handling a large volume
of data.
2. SQLite :
SQLite is a software library that provides a relational database management
system(RDBMS). It was designed by D. Richard Hipp on August 2000. The design
goals of SQLite were to allow the program to be operated without installing a database
management system(DBMS) or requiring a database administrator. The lite in SQLite
means light weight in terms of setup, database administration, and required resource.
Difference between MySQL and SQLite:
S.NO.
MySQL SQLite
1. Released by MySQL AB on May Developed By D. Richard Hipp
1995. Developed by Oracle since on August 2000.
2010.
5. It is highly scalable and can handle It can handle only small set of
a large volume of data very data if the volume of data
efficiently. increased its performance
degrades.
6. It requires large space in the It requires only some KBs of
memory for its functioning (approx space as it is very lightweight
600 Mb). approx (250Kb- 300Kb).
This project is built using Tkinter for GUI development, MySQL for database
management, and Python's MySQL Connector for seamless database connectivity. It
provides an intuitive and user-friendly interface for customers and support agents, ensuring
smooth query resolution and efficient ticket tracking.
Objectives
The main objectives of this project are:
To provide an admin panel for support staff to manage and resolve customer tickets.
Technology Purpose
Core programming
Python language for logic
implementation
GUI framework for user
Tkinter
interface design
Database for storing user
MySQL credentials, queries, and
ticket status
Enables communication
MySQL Connector between Python and
MySQL
Secure password hashing
bcrypt
for authentication
Technologies & Packages Used
The project is developed using the following technologies and libraries:
D. Database Connectivity
MySQL is used to store:
Functional Workflow
Expected Outcomes
Future Enhancements
import tkinter as tk
from tkinter import messagebox, ttk
import mysql.connector
# Database Connection
def connect_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="udhaya@1507 ",
database="customer_support"
)
def create_tables():
db = connect_db()
cursor = db.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100) UNIQUE,
password VARCHAR(100),
role ENUM('customer', 'admin')
)
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS tickets (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
subject VARCHAR(255),
message TEXT,
status ENUM('Open', 'In Progress', 'Resolved') DEFAULT 'Open',
response TEXT,
FOREIGN KEY (user_id) REFERENCES users(id
)
""")
db.commit()
db.close()
create_tables()
def login_screen(root):
for widget in root.winfo_children():
widget.destroy()
tk.Label(root, text="Login", font=("Times", 20, "bold"), bg="#f2f2f2").pack(pady=20)
tk.Label(root, text="Username", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
username_entry = tk.Entry(root)
username_entry.pack()
tk.Label(root, text="Password", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
password_entry = tk.Entry(root, show="*")
password_entry.pack()
tk.Button(root, text="Login", command=lambda: authenticate(root,
username_entry.get(), password_entry.get()),
bg="#4CAF50", fg="white").pack(pady=10)
tk.Button(root, text="Register", command=lambda: register_screen(root),
bg="#008CBA", fg="white").pack()
def register_user(root, username, password):
if not username or not password:
messagebox.showerror("Error", "Username and password cannot be empty")
return
db = connect_db()
cursor = db.cursor()
try:
cursor.execute("INSERT INTO users (username, password, role) VALUES (%s,
%s, 'customer')", (username, password))
db.commit()
messagebox.showinfo("Success", "Registration successful! You can now log in.")
login_screen(root)
except mysql.connector.IntegrityError:
messagebox.showerror("Error", "Username already exists. Try a different one.")
finally:
db.close()
def register_screen(root):
for widget in root.winfo_children():
widget.destroy()
tk.Label(root, text="Register", font=("Times", 20, "bold"),
bg="#f2f2f2").pack(pady=20)
tk.Label(root, text="Username", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
reg_username_entry = tk.Entry(root)
reg_username_entry.pack()
tk.Label(root, text="Password", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
reg_password_entry = tk.Entry(root, show="*")
reg_password_entry.pack()
tk.Button(root, text="Register",
command=lambda: register_user(root, reg_username_entry.get(),
reg_password_entry.get()), bg="#4CAF50",
fg="white").pack(pady=10)
tk.Button(root, text="Back to Login", command=lambda: login_screen(root),
bg="#008CBA", fg="white").pack()
def authenticate(root, username, password):
db = connect_db()
cursor = db.cursor()
cursor.execute("SELECT id, role FROM users WHERE username=%s AND
password=%s", (username, password))
user = cursor.fetchone()
db.close()
if user:
user_id, user_role = user
customer_dashboard(root, user_id) if user_role == 'customer' else
admin_dashboard(root)
else:
messagebox.showerror("Error", "Invalid credentials")
def admin_dashboard(root):
for widget in root.winfo_children():
widget.destroy()
tk.Label(root, text="Admin Dashboard", font=("Times", 20, "bold"),
bg="#f2f2f2").pack(pady=20)
tk.Button(root, text="Logout", command=lambda: login_screen(root),
bg="#FF5733", fg="white").pack()
def customer_dashboard(root, user_id):
for widget in root.winfo_children():
widget.destroy()
tk.Label(root, text="Customer Dashboard", font=("Times", 20, "bold"),
bg="#f2f2f2").pack(pady=20)
tk.Button(root, text="Create Ticket", command=lambda: create_ticket_screen(root,
user_id), bg="#4CAF50",
fg="white").pack(pady=5)
def create_ticket_screen(root, user_id):
for widget in root.winfo_children():
widget.destroy()
tk.Label(root, text="Create Support Ticket", font=("Times", 20, "bold"),
bg="#f2f2f2").pack(pady=20)
tk.Label(root, text="Subject", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
ticket_subject = tk.Entry(root)
ticket_subject.pack()
tk.Label(root, text="Message", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
ticket_message = tk.Text(root, height=5, width=40)
ticket_message.pack()
tk.Button(root, text="Submit",
command=lambda: submit_ticket(root, user_id, ticket_subject.get(),
ticket_message.get("1.0", tk.END)),
bg="#4CAF50", fg="white").pack(pady=10)
tk.Button(root, text="Back", command=lambda: customer_dashboard(root, user_id),
bg="#008CBA", fg="white").pack()
def submit_ticket(root, user_id, subject, message):
db = connect_db()
cursor = db.cursor()
cursor.execute("INSERT INTO tickets (user_id, subject, message) VALUES (%s, %s,
%s)", (user_id, subject, message))
db.commit()
ticket_id = cursor.lastrowid
cursor.execute("SELECT * FROM tickets WHERE id = %s", (ticket_id,))
ticket_details = cursor.fetchone()
db.close()
evidence_message = (
f"Ticket Submitted Successfully!\n\n"
f"Ticket ID: {ticket_details[0]}\n"
f"Subject: {ticket_details[2]}\n"
f"Message: {ticket_details[3]}\n"
f"Status: {ticket_details[4]}\n"
)
messagebox.showinfo("Ticket Submission Evidence", evidence_message)
customer_dashboard(root, user_id)
root = tk.Tk()
root.title("Customer Support System")
root.geometry("600x400")
root.configure(bg="#f2f2f2")
login_screen(root)
root.mainloop()
import tkinter as tk
from tkinter import ttk, messagebox
import mysql.connector
# Database Connection
def connect_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="udhaya@1507 ",
database="customer_support"
)
def fetch_tickets():
db = connect_db()
cursor = db.cursor()
cursor.execute("SELECT id, subject, message, response FROM tickets")
tickets = cursor.fetchall()
db.close()
return tickets
def update_response(ticket_id, response):
db = connect_db()
cursor = db.cursor()
cursor.execute("UPDATE tickets SET response=%s WHERE id=%s", (response,
ticket_id))
db.commit()
db.close()
messagebox.showinfo("Success", "Response updated successfully!")
show_tickets()
def delete_ticket(ticket_id):
db = connect_db()
cursor = db.cursor()
cursor.execute("DELETE FROM tickets WHERE id=%s", (ticket_id,))
db.commit()
db.close()
messagebox.showinfo("Success", "Ticket deleted successfully!")
show_tickets()
def show_tickets():
root = tk.Tk()
root.title("Ticket and Comment View")
root.geometry("900x500")
tree = ttk.Treeview(root, columns=("ID", "Subject", "Message", "Response"),
show="headings")
tree.heading("ID", text="Ticket ID")
tree.heading("Subject", text="Subject")
tree.heading("Message", text="Message")
tree.heading("Response", text="Response")
tree.column("ID", width=80)
tree.column("Subject", width=200)
tree.column("Message", width=300)
tree.column("Response", width=200)
tree.pack(fill=tk.BOTH, expand=True)
tickets = fetch_tickets()
for ticket in tickets:
tree.insert("", "end", values=ticket)
response_entry = tk.Entry(root, width=50)
response_entry.pack(pady=5)
def respond():
selected_item = tree.selection()
if not selected_item:
messagebox.showerror("Error", "No ticket selected")
return
ticket_id = tree.item(selected_item, "values")[0]
response = response_entry.get()
if response:
update_response(ticket_id, response)
else:
messagebox.showerror("Error", "Response cannot be empty")
def delete():
selected_item = tree.selection()
if not selected_item:
messagebox.showerror("Error", "No ticket selected")
return
ticket_id = tree.item(selected_item, "values")[0]
delete_ticket(ticket_id)
tk.Button(root, text="Respond", command=respond, bg="#4CAF50",
fg="white").pack(pady=5)
tk.Button(root, text="Delete", command=delete, bg="#FF5733",
fg="white").pack(pady=5)
root.mainloop()
if __name__ == "__main__":
show_tickets()
1. Database Setup
a) Connecting to MySQL
python
CopyEdit
def connect_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="udhaya@1507",
database="customer_support"
b) Creating Tables
python
CopyEdit
def create_tables():
db = connect_db()
cursor = db.cursor()
cursor.execute("""
password VARCHAR(100),
""")
cursor.execute("""
user_id INT,
subject VARCHAR(255),
message TEXT,
response TEXT,
""")
db.commit()
db.close()
users table stores id, username, password, and role (either ‘customer’ or ‘admin’).
2. User Authentication
a) Login Screen
python
CopyEdit
def login_screen(root):
widget.destroy()
username_entry = tk.Entry(root)
username_entry.pack()
password_entry.pack()
bg="#4CAF50", fg="white").pack(pady=10)
b) User Authentication
python
CopyEdit
db = connect_db()
cursor = db.cursor()
user = cursor.fetchone()
db.close()
if user:
3. User Registration
a) Registration Screen
python
CopyEdit
def register_screen(root):
widget.destroy()
reg_username_entry = tk.Entry(root)
reg_username_entry.pack()
reg_password_entry.pack()
tk.Button(root, text="Register",
fg="white").pack(pady=10)
tk.Button(root, text="Back to Login", command=lambda: login_screen(root),
bg="#008CBA", fg="white").pack()
b) Registering Users
python
CopyEdit
return
db = connect_db()
cursor = db.cursor()
try:
db.commit()
login_screen(root)
except mysql.connector.IntegrityError:
finally:
db.close()
python
CopyEdit
widget.destroy()
fg="white").pack(pady=5)
python
CopyEdit
widget.destroy()
ticket_subject = tk.Entry(root)
ticket_subject.pack()
tk.Label(root, text="Message", font=("Times", 20, "bold"), bg="#f2f2f2").pack()
ticket_message.pack()
tk.Button(root, text="Submit",
bg="#4CAF50", fg="white").pack(pady=10)
5. Admin Dashboard
python
CopyEdit
def admin_dashboard(root):
widget.destroy()
python
CopyEdit
def show_tickets():
root = tk.Tk()
root.geometry("900x500")
tree.heading("Subject", text="Subject")
tree.heading("Message", text="Message")
tree.heading("Response", text="Response")
tickets = fetch_tickets()
def respond():
selected_item = tree.selection()
response = response_entry.get()
update_response(ticket_id, response)
def delete():
selected_item = tree.selection()
delete_ticket(ticket_id)
tk.Button(root, text="Respond", command=respond, bg="#4CAF50",
fg="white").pack()
root.mainloop()
8.SCREEN LAYOUT
REGISTRATION PORTAL:
REGISTRATION SUCCESSFUL:
LOGIN PORTAL:
DASHBOARD:
CREATE YOUR TICKET:
System testing is a comprehensive testing process that evaluates the complete and
integrated software system to verify that it meets specified requirements. It involves testing the
software's functionality, reliability, and performance as a whole, rather than individual
components, to ensure overall system quality and effectiveness.
There are four levels of software testing: unit, integration testing, system testing and
acceptance testing, all are used for the testing purpose. Unit Testing used to test a single
software; Integration Testing used to test a group of units of software, System Testing used to
test a whole system and Acceptance Testing used to test the acceptability of business
requirements. Here we are discussing system testing which is the third level of testing levels.
The below flowchart shows where the System testing happens in the software
development life-cycle.
It is important to follow a specific order when testing software. Following is a
chronologically organized list of software testing categories.
System testing falls under Black box testing as it includes testing of the external working of the
software. Testing follows user's perspective to identify minor defects.
WEBSITES
o https://www.w3schools.com/python/
o https://www.geeksforgeeks.org/python-mysql-connection/
o https://docs.python.org/3/
o https://dev.mysql.com/doc/