prodevans / LEAP2.0

Leap 2.0 is a platform offered by Complete open Source Solutions(COSS),where students from different campus irrespective of all platforms can join to explore themselves with the limitless IT world by gaining knowledge on open source cutting edge technologies on demand and get opportunity to work on live projects.
3 stars 6 forks source link

GUI Window. #12

Closed jeethub26230 closed 4 years ago

jeethub26230 commented 4 years ago

Create a GUI window.

Note Markdown practice will be accepted.

bvjhansisaketa commented 4 years ago
from tkinter import *
uname=[]
age =[]
box = Tk()
fr1 =Frame(box)
fr1.pack(side='top')
fr2 =Frame(box)
fr2.pack()
lab1= Label(fr1,text = 'username :')
lab1.pack(side='left')
ent1 = Entry(fr1,width= 58)
ent1.pack()

lab3= Label(fr2,text = 'DOB(dd/mm/yyyy)')
lab3.pack(side='left')
ent3 = Entry(fr2,width= 58)
ent3.pack()

def ButC():
    a = ent1.get()
    c = ent3.get()
    d=c.split("/")
    uname.append(a)
    f= 2020-int(d[2])
    age.append(f)
    p= Label(box,text= "hi "+a+" !! Ur age is "+str(f))
    p.pack()
but = Button(box, text = 'submit', command = ButC,bg = 'red')
but.pack()
box.resizable(0,0)
box.mainloop()
srvk99 commented 4 years ago
from tkinter import *
from tkinter import messagebox

box = Tk()
box.title("By srvk99")

fr1 =Frame(box)
fr1.pack(side='top')

fr2 =Frame(box)
fr2.pack()

fr3 =Frame(box)
fr3.pack(padx=5,pady=10)

lab=Label(fr1,text="AGE CALCULATOR",fg = "red",font = "Times 15")
lab.pack(side='top')

lab1= Label(fr1,text = 'Username: ')
lab1.pack(side='left', padx=27)

ent1 = Entry(fr1,width= 50,font='Helvetica 10')
ent1.pack(side='left',pady=10)

lab3= Label(fr2,text = 'DOB(dd/mm/yyyy): ')
lab3.pack(side='left',padx=2,pady=10)

ent3 = Entry(fr2,width= 50,font='Helvetica 10')
ent3.pack(side='left',pady=10)

def dob_er():
    messagebox.showerror("Answer", "Entered DOB is invalid")
def uname_er():
    messagebox.showerror("Answer", "Please enter username.")
def format_er():
    messagebox.showerror("Answer", "Please follow (dd/mm/yyyy) format.")
def close_window ():
    box.destroy()

def calc():
    name = ent1.get()
    if (len(name)==0):
        raise Exception(uname_er())
    try:
        date,month,year= ent3.get().split("/")
    except:
        format_er()

    if(int(date) <=31 and int(date) >=1 and int(month)<=12 and int(month) >=1 and (2020 - int(year) >= 0)):
        p= Label(box,text= "Hi "+name+" !! You are "+str(2020-int(year))+" years old.")
        p.pack()
    else:
        dob_er()

but = Button(fr3, text = 'Calculate', command = calc,bg = 'green',bd =1,width=200,pady=7)
but.pack()
button = Button (fr3, text = "Exit", command = close_window,bg = 'red',bd =1,width=200,pady=7)
button.pack()
box.geometry("500x250")
box.mainloop()
vamsipvk2203 commented 4 years ago

Age calc by PVK

from tkinter import *
from tkinter import messagebox

box = Tk()
box.title("User Age Calculator")

fr1 = Frame(box)
fr1.pack(side = 'top')

fr2 = Frame(box)
fr2.pack(side = 'top')

fr3 = Frame(box)
fr3.pack()

label1 = Label(fr1,text = "Username : ")
label1.grid(padx = 10)

ent1 = Entry(fr1,width= 40)
ent1.grid()

label2 = Label(fr2,text = "Date Of Birth(dd/mm/yyyy) : ")
label2.grid()

ent2 = Entry(fr2,width = 40)
ent2.grid()

def functionall():
    uname = ent1.get()
    dob = ent2.get()
    if (len(uname) == 0):
        messagebox.showerror('Error', 'Please Enter the Username!')
    try:
        d, m, y = dob.split('/')
    except:
        messagebox.showerror('Error', 'Enter the date in correct format(dd/mm/yyyy)')

    if (int(d)>0 and int(d)<32 and int(m)>0 and int(m)<13 and int(y)<2020):
        if (int(d) > 5):
            label3 = Label(box, text="Hello " + uname + " !! You are " + str(2020 - 1 - int(y)) + " years old.")
            label3.pack()
        else:
            label3 = Label(box, text="Hello " + uname + " !! You are " + str(2020 - int(y)) + " years old.")
            label3.pack()
    else:
        messagebox.showerror('Error','Entered DOB is not valid')

but1 = Button(fr3,text = 'Age',command = functionall,width = 15)
but1.pack(pady = 5)

box.geometry("500x200")
box.resizable(0,0)
box.mainloop()
m-ankeeta commented 4 years ago

I am M Ankeeta


from tkinter import *
name=[]
age =[]
box = Tk()
fr1 =Frame(box)
fr1.pack(side='top')
fr2 =Frame(box)
fr2.pack()
lab1= Label(fr1,text = 'username :')
lab1.pack(side='left')
ent1 = Entry(fr1,width= 58)
ent1.pack()

lab3= Label(fr2,text = 'DOB(dd/mm/yyyy)')
lab3.pack(side='left')
ent3 = Entry(fr2,width= 58)
ent3.pack()

def ButC():
    a1 = ent1.get()
    a2= ent3.get()
    c=a2.split("/")
    uname.append(a1)
    f= 2020-int(c[2])
    age.append(f)
    p= Label(box,text= "hi "+a1+" !! Ur age is "+str(f))
    p.pack()
but = Button(box, text = 'submit', command = ButC,bg = 'red')
but.pack()
box.resizable(0,0)
box.mainloop
megha-biswas01 commented 4 years ago

from tkinter import *
from tkinter import messagebox

box = Tk()
box.title("Python Class")

name = []
age = []

l1 = Label(box, text = 'WELCOME TO AGE CALCULATOR', fg ='Blue', font ='Italic')
l1.pack()

fr1 = Frame(box)
fr1.pack(side = 'top')

fr2 = Frame(box)
fr2.pack()

lab1 = Label(fr1,text = 'UserName\t : ',font= 'Italic',)
lab1.pack(side = 'left',padx=2,)
ent1 = Entry(fr1,width = 50, borderwidth = 5, bg='Dark Gray' )
ent1.pack(pady=5,)

lab2 = Label(fr2,text = 'DOB(dd/mm/yy)\t : ' , font= 'Italic')
lab2.pack(side = 'left',padx=2)
ent2 = Entry(fr2,width = 50,borderwidth = 5,bg ='Dark gray')
ent2.pack()
def nameerror():
    messagebox.showerror("Warning", "Please enter Username ")

def ageerror():
    messagebox.showerror("Warning", "Please enter DOB ")

def callback():
    if messagebox.askyesno('Verify', 'Really quit?'):
        box.destroy()
    else:
        messagebox.showinfo('No', 'Quit has been cancelled')

def Click():
    a = ent1.get()
    b = ent2.get()

    if (len(a) == 0):
        nameerror()
    elif(len(b) == 0):
        ageerror()
    else:
        c = ent2.get()
        d = c.split("/")
        name.append(a)
        ag = 2020 - int(d[2])
        age.append(ag)
        p = Label(box, text="Hi ," + a + " !! Ur age is " + str(ag) + ".", fg = 'Blue')
        p.pack()

but1 = Button(box,text = 'Submit', command= Click, bg = 'Orange', fg = 'Red',font = 'Italic')
but1.pack()
but2 = Button(text='Quit', command=callback, bg = 'Orange', fg ='Red', font = 'Italic')
but2.pack(padx ='5' ,pady ='5')

box.resizable(2000,1200)
box.mainloop()
DinuDante commented 4 years ago
#This is Dinesh Behera
#I have edited the source code sent by Biswajeet Sir
from tkinter import *
uname=[]
age =[]
box = Tk()
fr1 =Frame(box)
fr1.pack(side='top')
fr2 =Frame(box)
fr2.pack()
lab1= Label(fr1,text = 'Username :')
lab1.pack(side='left')
ent1 = Entry(fr1,width= 50)
ent1.pack()

lab2= Label(fr2,text = 'DOB(DD/MM/YYYY)')
lab2.pack(side='left')
ent2 = Entry(fr2,width= 60)
ent2.pack()

def ButC():
    a = ent1.get()
    c = ent2.get()
    d=c.split("/")
    uname.append(a)
    e= 2020-int(d[2])
    age.append(e)
    p= Label(box,text= "Hi "+a+" !! Your Current age is "+str(e))
    p.pack()
but = Button(box, text = 'Submit', command = ButC,bg = 'red',fg = 'yellow')
but.pack()
box.resizable(0,0)
box.mainloop()
joellui commented 4 years ago

Link 2 files agefinder and test