Wpurplel / Experimental

Apache License 2.0
0 stars 0 forks source link

Registration #7

Open sydney2312 opened 9 months ago

sydney2312 commented 9 months ago

* means import everything from tkinter

from tkinter import *
root = Tk()

root.geometry("300x300")
root.title("  Registration ") 
root.configure(background="orange")

Label Widgets

firstname= Label(root,text="First name:",bg="white")
lastname= Label(root,text="Last name:",bg="white")
Address= Label(root,text="Address:",bg= "white")
Email= Label(root,text="Email:",bg= "white")
Phone= Label(root,text="Phone:", bg= "white")
Paymentmood= Label(root,text="Payment Mode:", bg = "white")

Size of Label Widgets

firstname.grid(row=1, column=0,padx=10, pady=10,sticky=W)
lastname.grid(row=2, column=0 , padx=10, pady=10,sticky=W)
Address.grid(row=3, column= 0, padx=10, pady=10,sticky=W)
Email.grid(row=4, column= 0, padx=10, pady=10,sticky=W)
Phone.grid(row=5, column= 0, padx=10, pady=10,sticky=W)
Paymentmood.grid(row=6, column= 0, padx=10, pady=10,sticky=W)

Var

firstnamevalue= StringVar
phonevalue=StringVar
lastnamevalue= StringVar
emailvalue=StringVar
paymentvalue=StringVar
address= StringVar
checkvalue= IntVar

Entry Widgets

firstnameentry= Entry(root, textvariable=firstnamevalue)
lastnameentry= Entry(root,textvariable=lastname)
address= Entry(root,textvariable=address)
emailentry= Entry(root, textvariable=emailvalue)
phoneentry= Entry(root, textvariable=phonevalue)

firstnameentry.grid(row=1, column=1)
lastnameentry.grid(row=2, column=1 )
address.grid(row=3, column=1)
emailentry.grid(row=4, column=1)
phoneentry.grid(row=5, column=1)

Drop Down Box

payment = StringVar()

# Option you see at output
payment.set("Credit Card")

drop = OptionMenu(root, payment, "Credit card","Paypal","Cash" )
bg= "white" 
fg= "green"

drop.grid(row=6, column=1 , padx=10, pady=10, sticky=W)

Pop up Box

import tkinter.messagebox 

def onClick(): 
       tkinter.messagebox.showinfo("" , "Verification Successful")

 # Button
button = Button(root, text="Register", command=onClick, height=1, width=5, padx=10, pady=10, bg='whitesmoke')

button.grid(row=7, column=1)

root.mainloop()