tkinter.Frame(height)


Definition
The height defines the height of the Frame in pixels.

Syntax
tkinter.Frame(height=number)

Example
Frame(height)
The Frame width, height, and background color is created.
from tkinter import*

master=Tk()

frame=Frame(master, width=300, height=300background="blue")

frame.pack()

master.mainloop()





tkinter.Frame(height)
The frame is adjusted in grid().
 from tkinter import*

master=Tk()
master.geometry("400x300")

frame1=Frame(master, width=200, height=150, background="Blue")
frame1.grid(row=0, column=0)

frame2=Frame(master, width=200, height=150, background="Red")
frame2.grid(row=1, column=0)

frame3=Frame(master, width=200, height=150, background="Green")
frame3.grid(row=0, column=1)

frame4=Frame(master, width=200, height=150, background="Yellow")
frame4.grid(row=1, column=1)

master.mainloop()





The frame "<ButtonRelease>" trigger the function(buttonrelease) which displays the Label(welcome).
from tkinter import *

master = Tk()

def buttonrelease(click):
    label=Label(frame, text="Welcome", fg="Blue")
    label.pack(side=TOP)

frame = Frame(master, background="blue", width=200, height=200)
frame.bind("<ButtonRelease>", buttonrelease)
frame.pack()

master.mainloop()








Comments