Friday, February 5, 2021

python day 31 tkinter entery widget

 


"""

from tkinter import *


root = Tk()

root.title("Basic Entry Widget")



lbl=Label(root, text="This is Label widget", fg='red', font=("Helvetica", 16))

lbl.place(x=60, y=50)

ent = Entry(root)#same like input

ent.pack()#particular window



ent1 = Entry(root)#same like input

ent1.pack()#particular window


ent2 = Entry(root)#same like input

ent2.pack()#particular window



def show_data():

    print(ent.get())

    print(ent1.get())

    print(ent2.get())

    

    

Button(root,text="Show ",command=show_data).pack()


root.mainloop()




#multiple windows


from tkinter import *

root = Tk()

root1 = Tk()


data = "Hotel Management"


w = Label(root1,fg='white', bg='green',text=data,font=("Helvetica", 30))

w.pack()



root.mainloop()



from tkinter import *

root = Tk()



data = "Hotel Management"


w = Label(root,fg='RED', bg='green',text="Hotel Management",font=("calibri", 30))

w.pack()



root.mainloop()

"""






from tkinter import *

root = Tk()

root.title("Radio Button")


Label(root,text="Select True or False",justify=LEFT).pack()



data = BooleanVar()


def data_print():

    print(data.get())


true_button = Radiobutton(root,

                          text = "Ture",

                          variable=data,

                          value= True,

                          padx=20,

                          pady=5,

                          command = data_print

                          )


false_button = Radiobutton(root,

                           text = "False",

                           variable=data,

                           value= False,

                           padx=20,

                           pady=5,

                           command = data_print

                          )

true_button.pack()

false_button.pack()


root.mainloop()


























No comments:

Post a Comment

python class topic video