1+ import tkinter as tk
2+ from tkinter import *
3+ from tkinter .ttk import *
4+ from tkinter import ttk
5+ import sqlite3
6+ # Create
7+ conn = sqlite3 .connect ('jobs.db' )
8+ 9+ # Cursor
10+ c = conn .cursor ()
11+ 12+ # # Create table
13+ c .execute ("""
14+ CREATE TABLE jobs(
15+ first_name text,
16+ last_name text,
17+ email text,
18+ education text,
19+ address1 text,
20+ address2 text,
21+ country text,
22+ city text,
23+ state text,
24+ zipcode text,
25+ phone1 text,
26+ phone2 text,
27+ hobbies text,
28+ company text,
29+ job text,
30+ duration text,
31+ r1_name text,
32+ r1_phone text,
33+ r2_name text,
34+ r2_phone text
35+ )
36+ """ )
37+ 38+ 39+ def submit ():
40+ 41+ # DB
42+ 43+ # Create
44+ conn = sqlite3 .connect ('jobs.db' )
45+ 46+ # Cursor
47+ c = conn .cursor ()
48+ 49+ # Insert
50+ c .execute ('INSERT INTO jobs VALUES(:first_name,:last_name,:email,:education,:address1,:address2,:country,:city,:state,:zipcode,:phone1,:phone2,:hobbies,:company,:job,:duration,:r1_name,:r1_phone, :r2_name,:r2_phone)' ,
51+ {
52+ 'first_name' : first_name .get (),
53+ 'last_name' : last_name .get (),
54+ 'email' : email .get (),
55+ 'education' : education .get (),
56+ 'address1' : address1 .get (),
57+ 'address2' : address2 .get (),
58+ 'country' : country .get (),
59+ 'city' : city .get (),
60+ 'state' : state .get (),
61+ 'zipcode' : zipcode .get (),
62+ 'phone1' : phone1 .get (),
63+ 'phone2' : phone2 .get (),
64+ 'hobbies' : hobbies .get (),
65+ 'company' : company .get (),
66+ 'job' : job .get (),
67+ 'duration' : duration .get (),
68+ 'r1_name' : r1_name .get (),
69+ 'r1_phone' : r1_phone .get (),
70+ 'r2_name' : r2_name .get (),
71+ 'r2_phone' : r2_phone .get ()}
72+ )
73+ 74+ # Commit changes
75+ conn .commit ()
76+ 77+ # Close connection
78+ conn .close ()
79+ 80+ 81+ 82+ 83+ def browsefunc ():
84+ filename = filedialog .askopenfilename ()
85+ pathlabel .config (text = filename )
86+ 87+ root = tk .Tk ()
88+ root .geometry ('500x500' )
89+ root .title ("Job application" )
90+ 91+ ttk .Label (root , text = "Job Application" ,font = ("bold" , 40 )).grid (row = 0 ,column = 0 ,columnspan = 3 ,pady = 2 )
92+ ttk .Label (root , text = "Personal Information" ,foreground = "brown" ,font = ("bold" , 20 )).grid (row = 1 ,column = 0 ,pady = 2 ,sticky = W )
93+ ttk .Label (root , text = "Name" ,font = ("bold" , 10 )).grid (row = 2 ,column = 0 ,pady = 2 ,sticky = W )
94+ ttk .Label (root , text = "Email" ,font = ("bold" , 10 )).grid (row = 3 ,column = 0 ,pady = 2 ,sticky = W )
95+ ttk .Label (root , text = "Education" ,font = ("bold" , 10 )).grid (row = 4 ,column = 0 ,pady = 2 ,sticky = W )
96+ ttk .Label (root , text = "Resume" ,font = ("bold" , 10 )).grid (row = 5 ,column = 0 ,pady = 2 ,sticky = W )
97+ ttk .Label (root , text = "Address" ,font = ("bold" , 10 )).grid (row = 6 ,column = 0 ,pady = 2 ,sticky = W )
98+ ttk .Label (root , text = "Phone Number" ,font = ("bold" , 10 )).grid (row = 10 ,column = 0 ,pady = 2 ,sticky = W )
99+ ttk .Label (root , text = "What are your hobbies?" ,font = ("bold" , 10 )).grid (row = 11 ,column = 0 ,pady = 2 ,sticky = W )
100+ ttk .Label (root , text = "Previous/Current Employment details" ,foreground = "brown" ,font = ("bold" , 20 )).grid (row = 13 ,column = 0 ,pady = 2 ,sticky = W )
101+ ttk .Label (root , text = "Company Name" ,font = ("bold" , 10 )).grid (row = 14 ,column = 0 ,pady = 2 ,sticky = W )
102+ ttk .Label (root , text = "Job Title" ,font = ("bold" , 10 )).grid (row = 15 ,column = 0 ,pady = 2 ,sticky = W )
103+ ttk .Label (root , text = "How long were you here?" ,font = ("bold" , 10 )).grid (row = 16 ,column = 0 ,pady = 2 ,sticky = W )
104+ ttk .Label (root , text = "Reference #1" ,foreground = "brown" ,font = ("bold" , 10 )).grid (row = 17 ,column = 0 ,pady = 2 ,sticky = W )
105+ ttk .Label (root , text = "Name" ,font = ("bold" , 10 )).grid (row = 18 ,column = 0 ,pady = 2 ,sticky = W )
106+ ttk .Label (root , text = "Phone" ,font = ("bold" , 10 )).grid (row = 19 ,column = 0 ,pady = 2 ,sticky = W )
107+ ttk .Label (root , text = "Reference #2" ,foreground = "brown" ,font = ("bold" , 10 )).grid (row = 20 ,column = 0 ,pady = 2 ,sticky = W )
108+ ttk .Label (root , text = "Name" ,font = ("bold" , 10 )).grid (row = 21 ,column = 0 ,pady = 2 ,sticky = W )
109+ ttk .Label (root , text = "Phone" ,font = ("bold" , 10 )).grid (row = 22 ,column = 0 ,pady = 2 ,sticky = W )
110+ first_name = tk .Entry (root ,width = 30 ) # first name
111+ first_name .insert (0 ,'First name' )
112+ last_name = tk .Entry (root ,width = 30 ) # last name
113+ last_name .insert (0 ,'Last name' )
114+ email = tk .Entry (root ,width = 60 ) # email
115+ email .insert (0 ,'user@example.com' )
116+ address1 = tk .Entry (root ,width = 60 ) #address1
117+ address2 = tk .Entry (root ,width = 60 ) #address2
118+ city = tk .Entry (root ,width = 20 ) #city
119+ state = tk .Entry (root ,width = 20 ) #state
120+ zipcode = tk .Entry (root ,width = 20 ) #zipcode
121+ phone1 = tk .Entry (root ,width = 30 )
122+ phone2 = tk .Entry (root ,width = 30 )# phone
123+ hobbies = tk .Entry (root ,width = 180 ) #hobbies
124+ company = tk .Entry (root ,width = 30 )
125+ job = tk .Entry (root ,width = 30 )
126+ duration = tk .Entry (root ,width = 30 )
127+ r1_name = tk .Entry (root ,width = 30 )
128+ r1_phone = tk .Entry (root ,width = 30 )
129+ r2_name = tk .Entry (root ,width = 30 )
130+ r2_phone = tk .Entry (root ,width = 30 )
131+ first_name .grid (row = 2 ,column = 1 ,pady = 2 ,sticky = W )
132+ last_name .grid (row = 2 ,column = 2 ,pady = 2 ,sticky = W )
133+ email .grid (row = 3 ,column = 1 ,columnspan = 2 ,pady = 2 ,sticky = W )
134+ address1 .grid (row = 6 ,column = 1 ,columnspan = 2 ,pady = 2 ,sticky = W )
135+ address2 .grid (row = 7 ,column = 1 ,columnspan = 2 ,pady = 2 ,sticky = W )
136+ city .grid (row = 9 ,column = 1 ,pady = 2 ,sticky = W )
137+ state .grid (row = 9 ,column = 2 ,pady = 2 ,sticky = W )
138+ zipcode .grid (row = 9 ,column = 3 ,pady = 2 ,sticky = W )
139+ phone1 .grid (row = 10 ,column = 1 ,pady = 2 ,sticky = W )
140+ phone2 .grid (row = 10 ,column = 2 ,pady = 2 ,sticky = W )
141+ hobbies .grid (row = 12 ,column = 0 ,columnspan = 4 ,pady = 2 ,sticky = W )
142+ company .grid (row = 14 ,column = 1 ,pady = 2 ,sticky = W )
143+ job .grid (row = 15 ,column = 1 ,pady = 2 ,sticky = W )
144+ duration .grid (row = 16 ,column = 1 ,pady = 2 ,sticky = W )
145+ r1_name .grid (row = 18 ,column = 1 ,pady = 2 ,sticky = W )
146+ r1_phone .grid (row = 19 ,column = 1 ,pady = 2 ,sticky = W )
147+ r2_name .grid (row = 21 ,column = 1 ,pady = 2 ,sticky = W )
148+ r2_phone .grid (row = 22 ,column = 1 ,pady = 2 ,sticky = W )
149+ 150+ education = tk .StringVar ()
151+ education .set ('Please choose' )
152+ choose = ttk .Combobox (root ,width = 57 ,textvariable = education )
153+ choose ['values' ]= ('12th pass' ,'B.Tech' ,'M.Tech' ,'BS' ,'MS' ,'PhD' )
154+ choose .grid (row = 4 ,column = 1 ,columnspan = 2 ,sticky = W )
155+ choose .current ()
156+ 157+ country = tk .StringVar ()
158+ country .set ('Select a Country' )
159+ choose = ttk .Combobox (root ,width = 57 ,textvariable = country )
160+ choose ['values' ]= ('America' ,'Russia' ,'Germany' ,'India' ,'Indonesia' ,'China' ,'Japan' )
161+ choose .grid (row = 8 ,column = 1 ,columnspan = 2 ,sticky = W )
162+ choose .current ()
163+ 164+ btn = Button (root ,width = 57 , text = 'Choose file' , command = browsefunc )
165+ btn .grid (row = 5 ,column = 1 ,columnspan = 2 ,sticky = W )
166+ pathlabel = Label (root )
167+ pathlabel .grid (row = 5 ,column = 1 ,columnspan = 2 ,sticky = W )
168+ 169+ Button (root , text = 'Apply' ,width = 20 , command = submit ).place (x = 180 ,y = 640 )
170+ root .mainloop ()
0 commit comments