Thursday, November 21, 2019

tkinter label example

from tkinter import *
root = Tk()

one =Label(root,text="ONE",bg="red",fg="white")
one.pack()
two =Label(root,text="TWO",bg="green",fg="black")
two.pack(fill=X)
three =Label(root,text="THREE",bg="blue",fg="white")
three.pack(side=LEFT,fill=Y)


root.mainloop()

output:

tkinter example making of button


from tkinter import *

mm32=tk.Tk()

topframe = Frame(mm32)
topframe.pack()
bottomframe=Frame(mm32)
bottomframe.pack(side=BOTTOM)

button1=Button(topframe,text="MM32F",fg="red",font=('Helvetica', 15))
button2=Button(topframe,text="MM32L",fg="red",font=('Helvetica', 15))
button3=Button(topframe,text="MM32SPIN",fg="red",font=('Helvetica', 15))
button4=Button(topframe,text="MM32W",fg="red",font=('Helvetica', 15))
button5=Button(topframe,text="MM32P",fg="red",font=('Helvetica', 15))

button1.pack(side=LEFT)
button2.pack(side=LEFT)
button3.pack(side=LEFT)
button4.pack(side=LEFT)
button5.pack(side=LEFT)

mm32.mainloop()

OUTPUT:


tkinter introduction


from tkinter import *
root = Tk()
root.mainloop()

output:




from tkinter import *

mm32=tk.Tk()

thelabel=tk.Label(text="MM32_DATASHEETS", font=('Helvetica',20), fg='green')
thelabel.pack()
mm32.configure(background="light green")

mm32.mainloop()

output:

python class topic video