Skip to content

Noah12398/GUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

GUI

Creating a GUI using python tkinter import tkinter import tkinter as tk from tkinter import ttk from tkinter import *

Create the main window

root= tk.Tk() root.title("Registration Form") root.geometry("750x775+450+0") root.configure(background="thistle2",border="30",highlightbackground="orange",highlightthickness="20") #Disappearing text def temp_text(e): entry5.delete(0,"end")

Create labels

label0=tk.Label(root,text="STUDENT REGISTRATION FORM",background="thistle2",foreground="red",font=('',15)) label1 = tk.Label(root, text="First Name",background="thistle2",foreground="blue") label2 = tk.Label(root, text="Last Name",background="thistle2",foreground="blue") label3 = tk.Label(root, text="Gender",background="thistle2",foreground="blue") label4 = tk.Label(root, text="Age",background="thistle2",foreground="blue") label5 = tk.Label(root, text="Date of Birth",background="thistle2",foreground="blue") label6 = tk.Label(root, text="Email Address",background="thistle2",foreground="blue") label7 = tk.Label(root, text="Password",background="thistle2",foreground="blue") label8 = tk.Label(root, text="Confirm Password",background="thistle2",foreground="blue") label9 = tk.Label(root, text="Phone Number",background="thistle2",foreground="blue") label10 = tk.Label(root, text="Address",background="thistle2",foreground="blue") label11 = tk.Label(root, text="State",background="thistle2",foreground="blue") label12 = tk.Label(root, text="Pincode",background="thistle2",foreground="blue") label13 = tk.Label(root, text="Hobbies",background="thistle2",foreground="blue") label14 = tk.Label(root, text="Upload Photo",background="thistle2",foreground="blue") label15 = tk.Label(root, text="I hereby declare that the information provided is correct",background="thistle2",foreground="blue")

Create entry fields

entry1 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry2 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry4 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry5 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry5.insert(0,"dd-mm-yyyy") entry5.bind("",temp_text) entry6 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") password = tk.Entry(root, show="*",border="2",highlightbackground="red",highlightthickness="1",width="50") entry8 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry9 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="42") entry10 = tk.Text(root,height=3,width=38,border="2",highlightbackground="red",highlightthickness="1") entry12 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry13 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") entry14 = tk.Entry(root,border="2",highlightbackground="red",highlightthickness="1",width="50") submit_button = tk.Button(root, text="Submit") male_radio = tk.Radiobutton(root,text="Male",value="Male",background="thistle2",highlightbackground="red",highlightthickness="1") female_radio = tk.Radiobutton(root, text="Female",value="Female",background="thistle2") #Combobox statecombo=ttk.Combobox(root,width=48) style=ttk.Style() style.configure(statecombo,border="2",highlightbackground="red",highlightthickness="1") statecombo['values']=('Kerala','Tamil Nadu','Andra Pradesh','Karnataka','Telangana','Maharashtra') phonecombo=ttk.Combobox(root,width=4) style=ttk.Style() style.configure(phonecombo,border="2",highlightbackground="red",highlightthickness="1") phonecombo['values']=('+91','+92','93')

Create checkboxes

checkbox1 = tk.Checkbutton(root, text="Music",background="thistle2") checkbox2 = tk.Checkbutton(root, text="Chess",background="thistle2") checkbox3 = tk.Checkbutton(root, text="Reading",background="thistle2") checkbox4 = tk.Checkbutton(root, text="Football",background="thistle2") checkbox5 = tk.Checkbutton(root, text="",background="thistle2")

Create a button

upload_photo = tk.Button(root, text="Choose File") register = tk.Button(root, text="Register",font=("Arial", 12), bg="powderblue", fg="black", relief=tk.RAISED) reset = tk.Button(root, text="Reset",font=("Arial", 12), bg="powderblue", fg="black", relief=tk.RAISED)

Place labels, entry fields, and button on the form

label0.pack() label1.place(x=100,y=75) entry1.place(x=245,y=75) label2.place(x=100,y=110) entry2.place(x=245,y=110) label3.place(x=100,y=145) female_radio.place(x=245, y=145) male_radio.place(x=410, y=145) label4.place(x=100,y=180) entry4.place(x=245,y=180) label5.place(x=100,y=215) entry5.place(x=245,y=215) label6.place(x=100,y=250) entry6.place(x=245,y=250) label7.place(x=100,y=285) password.place(x=245, y=285) label8.place(x=100,y=320) entry8.place(x=245,y=320) label9.place(x=100,y=355) phonecombo.place(x=245,y=355) entry9.place(x=295,y=355) label10.place(x=100,y=390) entry10.place(x=245,y=390) label11.place(x=100,y=460) statecombo.place(x=245,y=460) label12.place(x=100,y=495) entry12.place (x=245,y=495) label13.place(x=100,y=530) checkbox1.place(x=245,y=530) checkbox2.place(x=320,y=530) checkbox3.place(x=395,y=530) checkbox4.place(x=482,y=530) label14.place(x=100,y=565) upload_photo.place(x=245,y=565) checkbox5.place(x=100,y=600) label15.place(x=245,y=600)

Create horizontal lines as Frames

line1 = tk.Frame(root, height=0, width=645, bg="black") line1.place(y=635) register.place(x=100,y=650) reset.place(x=450,y=650) root.mainloop()

About

Creating a GUI using python tkinter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published