Python‎ > ‎tkinter‎ > ‎

tkinter.BOTTOM


Definition
put the widget to the Bottom.

Syntax
tkinter.BOTTOM

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()






The button has positioned in LEFT, RIGHT, TOP, and BOTTOM in the Tk Widget.
import tkinter

master=tkinter.Tk()
master.title("tkinter.LEFT, RIGHT, TOP, BOTTOM")
master.geometry("450x350")

button1=tkinter.Button(master, text="LEFT")
button1.pack(side=tkinter.LEFT)

button2=tkinter.Button(master, text="RIGHT")
button2.pack(side=tkinter.RIGHT)

button3=tkinter.Button(master, text="TOP")
button3.pack(side=tkinter.TOP)

button4=tkinter.Button(master, text="BOTTOM")
button4.pack(side=tkinter.BOTTOM)

master.mainloop()






tkinter


Comments