-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCheckbutton [full].py
57 lines (42 loc) · 1.49 KB
/
Checkbutton [full].py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#;==========================================
#; Title: Checkbutton full feature
#; Author: @AyemunHossain
#;==========================================
import tkinter as tk
from tkinter import messagebox
def check_info(e1,e2,ch):
if(e1.get() =='' or e2.get() == ''):
messagebox.showerror("You need to fill everything")
elif ch.get() == 0:
messagebox.showwarning("Fill the checkbox")
else:
messagebox.showinfo("Registration Successful :)")
e1.set('')
e2.set('')
ch.set(0)
return
class LoginPage(tk.Tk):
def __init__(self,root,*args,**kwargs):
root.title(string='LOGIN PAGE')
#Required variable
e1 = tk.StringVar()
e2 = tk.StringVar()
ch = tk.IntVar()
frame1 = tk.Frame(root,height=400,width=400)
frame1.pack()
label1 = tk.Label(frame1, text='Name')
label2 = tk.Label(frame1, text='Password')
label1.grid(row=4, column=0, sticky=tk.E)
label2.grid(row=5, column=0, sticky=tk.E)
entry1 = tk.Entry(frame1,textvariable=e1)
entry2 = tk.Entry(frame1,textvariable=e2)
entry1.grid(row=4, column=1)
entry2.grid(row=5, column=1)
chk = tk.Checkbutton(frame1, text='KEEP ME LOGGED IN',variable=ch)
chk.grid(row=6, column=1)
btn = tk.Button(frame1, text='SUBMIT',command=lambda :check_info(e1,e2,ch))
btn.grid(row=7, column=1)
root = tk.Tk()
root.geometry('550x180')
a = LoginPage(root)
root.mainloop()