Registration Form Using Tkinter in Python With Source Code

The Registration Form Using Tkinter can be helpful when you are starting to develop your own system in Python. This registration can be included in any type of system.

A Registration Form In Python Using Tkinter is quite useful, and the concept and logic of the project are simple to grasp.

The source code is open source and free to use. Simply scroll down and click the download option.

Project Output:

Registration Form
Registration Form
Registration Form
Registration Form
Registration Form Successfully Created!
Registration Form Successfully Created!

What Is Student Registration Form In Python Using Tkinter?

The Registration Form In Python With Database is a set of fields into which a user enters information and submits it to a business or individual.

There are a variety of reasons why you might want someone to complete a registration form.

Customers sign up for subscriptions, services, and other programs or plans using registration forms.

About the Project

The Registration Form Using Python And MySQL is a desktop application written and designed in the Python programming language.

Additionally, this project is open source, and it was made for novices who wish to learn Python.

Also, this Python Tkinter Registration Form is a set of lists that can be used to input data to be inserted into any type of storage that can be useful for anyone who wants to develop a system from scratch.

Project Details and Technology

Project Name:Student Registration Form in Python Using Tkinter
Abstract:This Registration Form is a simple Python project designed to assist IT students with their projects or assignments as well as developers who want this project to be included in their system.
Language/s Used:Python (GUI Based)
Python version (Recommended):3.8 or 3.9
Type:Desktop Application
Developer:Source Code Hero
Updates:0
Registration Form Using Tkinter With Source Code – Project Information

How To Make A Registration Form In Python?

The code given below is the full source code on the Registration Form Using Tkinter

Installed Libraries!

from tkinter import *
import tkinter.messagebox as tkMessageBox
import mysql.connector
from mysql.connector import Error

Complete Source Code!

from tkinter import *
import tkinter.messagebox as tkMessageBox
import mysql.connector
from mysql.connector import Error

root = Tk()
root.title("Python - Basic Register Form")
 
width = 640
height = 480
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x = (screen_width/2) - (width/2)
y = (screen_height/2) - (height/2)
root.geometry("%dx%d+%d+%d" % (width, height, x, y))
root.resizable(0, 0)


#=======================================VARIABLES=====================================
USER = StringVar()
PASS = StringVar()
NAME = StringVar()
ADDRESS = StringVar()

#=======================================METHODS=======================================
def Database():
    global conn, cursor
    conn = mysql.connector.connect(host='localhost',
                                         database='registerdb',
                                         user='root',
                                         password='')
    cursor = conn.cursor()


def Exit():
    result = tkMessageBox.askquestion('System', 'Are you sure you want to exit?', icon="warning")
    if result == 'yes':
        root.destroy()
        exit()


def Register():
    Database()
    if USER.get == "" or PASS.get() == "" or NAME.get() == "" or ADDRESS.get == "":
        lbl_result.config(text="Please complete the required field!", fg="orange")
    else:
        cursor.execute("SELECT * FROM `user` WHERE `user` = %s", [USER.get()])
        if cursor.fetchone() is not None:
            lbl_result.config(text="Username is already taken", fg="red")
        else:
            cursor.execute("INSERT INTO `user` (user, pass, name, address) VALUES(%s, %s, %s, %s)", (str(USER.get()), str(PASS.get()), str(NAME.get()), str(ADDRESS.get())))
            conn.commit()
            USER.set("")
            PASS.set("")
            NAME.set("")
            ADDRESS.set("")
            lbl_result.config(text="Successfully Created!", fg="green")
        cursor.close()
        conn.close()

#=====================================FRAMES====================================
TitleFrame = Frame(root, height=100, width=640, bd=1, relief=SOLID)
TitleFrame.pack(side=TOP)
RegisterFrame = Frame(root)
RegisterFrame.pack(side=TOP, pady=20)


#=====================================LABEL WIDGETS=============================
lbl_title = Label(TitleFrame, text="IT SOURCECODE - Register Form", font=('arial', 18), bd=1, width=640)
lbl_title.pack()
lbl_username = Label(RegisterFrame, text="Username:", font=('arial', 18), bd=18)
lbl_username.grid(row=1)
lbl_password = Label(RegisterFrame, text="Password:", font=('arial', 18), bd=18)
lbl_password.grid(row=2)
lbl_firstname = Label(RegisterFrame, text="Name:", font=('arial', 18), bd=18)
lbl_firstname.grid(row=3)
lbl_lastname = Label(RegisterFrame, text="Address:", font=('arial', 18), bd=18)
lbl_lastname.grid(row=4)
lbl_result = Label(RegisterFrame, text="", font=('arial', 18))
lbl_result.grid(row=5, columnspan=2)


#=======================================ENTRY WIDGETS===========================
user = Entry(RegisterFrame, font=('arial', 20), textvariable=USER, width=15)
user.grid(row=1, column=1)
pass1 = Entry(RegisterFrame, font=('arial', 20), textvariable=PASS, width=15, show="*")
pass1.grid(row=2, column=1)
name = Entry(RegisterFrame, font=('arial', 20), textvariable=NAME, width=15)
name.grid(row=3, column=1)
address = Entry(RegisterFrame, font=('arial', 20), textvariable=ADDRESS, width=15)
address.grid(row=4, column=1)
#========================================BUTTON WIDGETS=========================
btn_register=Button(RegisterFrame, font=('arial', 20), text="Register", command=Register)
btn_register.grid(row=6, columnspan=2)
#========================================MENUBAR WIDGETS==================================
menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Exit", command=Exit)
menubar.add_cascade(label="File", menu=filemenu)
root.config(menu=menubar)


#========================================INITIALIZATION===================================
if __name__ == '__main__':
    root.mainloop()
   

By the way, if you are new to Python programming and you don’t have any idea what Python IDE to use, I have here a list of the Best Python IDE for Windows, Linux, Mac OS for you.

Additionally, I also have here How to Download and Install the Latest Version of Python on Windows.

To start executing a Registration Form Using Tkinter, make sure that you have installed Python on your computer.

Steps On How To Run The Project

Time needed: 5 minutes

These are the steps on how to run the Registration Form Using Tkinter With Source Code.

  • Step 1: Download Source Code

    First, find the downloadable source code below and click to start downloading the source code file.
    Leave Management System Project In Python Download Button

  • Step 2: Extract File

    Next, after finished to download the file, go to file location and right click the file and click extract.
    Leave Management System Project In Python Extract File

  • Step 3: Open Project Path and Open CMD (Command Prompt).

    In order for you to run the project, you just need to open the project path and type CMD. The first thing you need to do is type py index.py in the command prompt. After that, just wait for a few seconds to load the system.
    Registration Form Using Tkinter Execute Project

Download the Source Code below!

Summary

This Article is a way to enhance and develop our skills and logic ideas which is important in practicing the python programming language which is the most well-known and most usable programming language in many companies.

Inquiries

If you have any questions or suggestions about the Registration Form Using Tkinter, please feel free to leave a comment below.

Leave a Comment