Tkinter.LabelFrame(text)

Definition
Create the Text in the LabelFrame

Syntax
LabelFrame(text="String")

Examples
The Checkbutton is placed inside the LabelFrame.

 from tkinter import*
master=Tk()

labelframe=LabelFrame(master, text="Your age")
labelframe.pack(side=LEFT)

checkbutton1=Checkbutton(labelframe, text=" 16+")
checkbutton1.pack()

checkbutton2=Checkbutton(labelframe, text=" 30+")
checkbutton2.pack()

checkbutton3=Checkbutton(labelframe, text=" 40+")
checkbutton3.pack()

checkbutton3=Checkbutton(labelframe, text=" 60+")
checkbutton3.pack()

master.mainloop()





Definition
Create font graphics of the frame label.

Syntax
tkinter.LabelFrame(fg="color")
LabelFrame(fg="color")

Examples
The button command function is used to invoke the message box to display the random value.
from tkinter import*

master = Tk()
master.title("Random Widget")

def random_value():
    import random
    random1=random.random()
    messagebox.showinfo("Random Value is", random1)

labelframe=LabelFrame(master, fg="red", font=14, text="Random value generator")
labelframe.pack(side=BOTTOM)

button = Button(labelframe, text = "Click here", fg="blue", command = random_value)
button.pack(side=BOTTOM)

label = Label(labelframe, text = "Click on button to generate random value")
label.pack(side=BOTTOM)

master.mainloop()




Comments