Python Inventory System Source Code

Inventory Management System Source Code Using Python Tkinter And MySQL Database

Pyhon Inventory System Source Code


in this python project demo you will see how to use this python inventory management system created using tkinter with mysql database.

tools:
- python programming language.
- VsCode.
- mysql database.
- canva.com for images.
- flatuicolorpicker.com for colors.
- text file to generate order.

Watch This Full Project Demo


if you want the source code click on the download button below





1 - Login Form

the login form allow the ADMIN and the other USERS to login into the application Home Form

Login Form


if the user enter wrong username or password a message will show up

Login Form

and if everything is ok, when you click on the login button the main/home form will show up and the login form will hide it self.


2 - Home Form

if the user type is ADMIN a "user" tab will be visible on the top menu.
this form contains some inventory analytics

Home Form


if the user type is USER the "user" tab will be invisible

Home Form


3 - Product Section


when you click on the Product tab, you can select add, edit, remove or show list of products.

menu - product


PRODUCTS LIST

- a frame contains all products displayed in a treeviesw.

PRODUCTS LIST


- when you enter a value in the search box and click search button, only the products that contain this value will be shown in the treeview.


search products


if you click "Add" on the menu the Add Product Frame will show up, this form allow you to enter the new product data and insert it into mysql database.


Add Product Frame


on the top form you can see a combobox categories, this combobox is populated from category table in the mysql database with the category name and id.

Add Product Frame


Add Product Frame

Add Product Frame

Add Product Frame


and if you want to update a product, click edit on the menu.
the "Edit Selected Product" will show up. 

Edit Selected Product

Edit Selected Product

Edit Selected Product

Edit Selected Product

Edit Selected Product

Edit Selected Product


when you want to delete a product just select the "Remove" from the menu and the "Remove Product" frame will show up.
enter a valid product id and click "Delete Selected Product"

Delete Selected Product

Delete Selected Product


4 - Category Section

now if you want to manage the categories you have to go to the category tab.
- when you click on the category tab and click manage, the MANAGE CATEGORIES FORM will show up.

- you can insert a new category by just entering the name on the textfield and click the "Add New Category" button.

- the MANAGE CATEGORIES FORM contain a treeview with all the categories name and id.

- if you select a category from the treeview -> the data of the selected category will be displayed on the textfields. 

- also a navigation buttons for next and previous .



MANAGE CATEGORIES FORM

MANAGE CATEGORIES FORM

MANAGE CATEGORIES FORM



5 - Customer Section


in this section you can:

- see all the customers in database displayed on treeview.

- get the selected customer data from treeview and set it into textfields.

- insert a new customer.

- update the selected customer data.

- delete the selected customer.

- clear all textfields text using the "clear" buttons.

- display the selected customer orders count.

- display the selected customer total orders amount.

- display the selected customer last order date.

manage customers

manage customers

manage customers

6 - Order Section


when you click on the order tab and select manage, the MANAGE ORDERS FORM will show up, and this form contain:

- 1 treeview with all customers.

- 1 treeview for products ( show products depending on combobox category ).

- 1 treeview to display the products you want to add into the order .

MANAGE ORDERS FORM


on the treeview for customers, if you select a row the customer id will be set into the textfield id.

MANAGE ORDERS FORM - Select Customer


now if you want to add products to the order follow those steps:

1 - select the product you want from the products treeview (you can select the category from combobx ).

MANAGE ORDERS FORM - products list

MANAGE ORDERS FORM - products list


2 - when you click on the product you want to add -> click on the ">>>" button enter the quantity you want, you can't let the box empty or enter a heigher quantity than the one available on the database.


enter quantity


and if everything is ok, the selected product will be add to the order treeview with the quantity you want.


products ordered


products ordered




- in the treeview you can see a column "Units X Price" where we calculate the total price for this product.
- on the top you can see the total amount of all products in the order.


order buttons


- the "Remove Product" button allow you to remove the selected product from the order treeview. - the "Clear" button allow you to remove all products from the order treeview an set total to 0.

if all is good, click the "Add Order" button to add the new order with the details into the database.

- now if you want to see all orders, go to the order tab on the menu and select "Show Orders".


orders list

orders list


when you click on "Print Selected Order" the selected order will be printed into a text file.


print order


7 - User Section

and the last one is the user tab ( for admins only ), so when you click on it the  MANAGE USERS FORM will show up with all the users displayed on a treeview.
if you select a user from the treeview all the data will be set into textfields so you can delete or edit the user informations.
- and to add a new user enter the user informations and click on the "Add" button.


MANAGE USERS FORM

MANAGE USERS FORM

you can show and hide password by clicking on the show checkbox

show and hide password


MANAGE USERS FORM






if you want the source code click on the download button below







Delivery: Instant Source Code Download.



Python Tkinter Quiz App Source Code

How To Make a Python Quiz Project Using Tkinter

Python Tkinter Quiz App Source Code


In this Python Tutorial we will see How to Make a Simple Quiz App Using Tkinter .
to create this quiz app we will use frame, radiobuttons, stringVar, buttons.








Project Source Code:


import tkinter as tk
from tkinter import StringVar

root = tk.Tk()
root.geometry('500x500')

questions = ["1 + 1 = ?","2 + 2 = ?","3 + 3 = ?","4 + 4 = ?","5 + 5 = ?"]
options = [['A','B','2','C','2'],['A','4','V','C','4'],
['A','B','Z','6','6'],['8','B','D','C','8'],['D','10','A','C','10']]


frame = tk.Frame(root, padx=10, pady=10,bg='#fff')
question_label = tk.Label(frame,height=5, width=28,bg='grey',fg="#fff",
font=('Verdana', 20),wraplength=500)


v1 = StringVar(frame)
v2 = StringVar(frame)
v3 = StringVar(frame)
v4 = StringVar(frame)

option1 = tk.Radiobutton(frame, bg="#fff", variable=v1, font=('Verdana', 20),
command = lambda : checkAnswer(option1))
option2 = tk.Radiobutton(frame, bg="#fff", variable=v2, font=('Verdana', 20),
command = lambda : checkAnswer(option2))
option3 = tk.Radiobutton(frame, bg="#fff", variable=v3, font=('Verdana', 20),
command = lambda : checkAnswer(option3))
option4 = tk.Radiobutton(frame, bg="#fff", variable=v4, font=('Verdana', 20),
command = lambda : checkAnswer(option4))

button_next = tk.Button(frame, text='Next',bg='Orange', font=('Verdana', 20),
command = lambda : displayNextQuestion())

frame.pack(fill="both", expand="true")
question_label.grid(row=0, column=0)

option1.grid(sticky= 'W', row=1, column=0)
option2.grid(sticky= 'W', row=2, column=0)
option3.grid(sticky= 'W', row=3, column=0)
option4.grid(sticky= 'W', row=4, column=0)

button_next.grid(row=6, column=0)


index = 0
correct = 0

# create a function to disable radiobuttons
def disableButtons(state):
option1['state'] = state
option2['state'] = state
option3['state'] = state
option4['state'] = state


# create a function to check the selected answer
def checkAnswer(radio):
global correct, index
# the 4th item is the correct answer
# we will check the user selected answer with the 4th item
if radio['text'] == options[index][4]:
correct +=1

index +=1
disableButtons('disable')


# create a function to display the next question
def displayNextQuestion():
global index, correct

if button_next['text'] == 'Restart The Quiz':
correct = 0
index = 0
question_label['bg'] = 'grey'
button_next['text'] = 'Next'

if index == len(options):
question_label['text'] = str(correct) + " / " + str(len(options))
button_next['text'] = 'Restart The Quiz'
if correct >= len(options)/2:
question_label['bg'] = 'green'
else:
question_label['bg'] = 'red'





else:
question_label['text'] = questions[index]
disableButtons('normal')
opts = options[index]
option1['text'] = opts[0]
option2['text'] = opts[1]
option3['text'] = opts[2]
option4['text'] = opts[3]
v1.set(opts[0])
v2.set(opts[1])
v3.set(opts[2])
v4.set(opts[3])

if index == len(options) - 1:
button_next['text'] = 'Check the Results'





displayNextQuestion()

root.mainloop()

                                       

////// OUTPUT : 

Python Tkinter Quiz App Source Code

Python Tkinter Quiz Project Source Code

Python Tkinter Quiz Program Source Code

Python Quiz App Source Code

Python Tkinter Quiz Program



if you want the source code click on the download button below


download the source code