today topic is styling in tkinter
Whole thing in a video
styling is a basic and important roll in tkinter
first make a label or button
i will make a label name m
m=Label(root,text="hi",background="green").place(x=66,y=44) -
background="colour you want" this wil clange label background colour to green
you can use bg as background
m=Label(root,text="hi",foreground="green").place(x=66,y=44) -
foreground="colour you want" this wil clange label foreground colour to green
you can use fg as foreground
m=Label(root,text="hi",bg="green",borderwidth="59",font="helvetica 40 bold").place(x=66,y=44) -
font is property controler of label, button etc like font ="style,size,bold or not or bold italic "
other types of font style like
Times,Timesnewroman etc
use of relief
m=Label(root,text="hi",bg="green",borderwidth="59",relief=RAISED).place(x=66,y=44) -
relief="your style"
note* always relief style name capital like SUNKEN this is correct , SUNken THIs is wrong
In last I explain about full use of .pack() , .grid() , .place() extension
like in grid we can use pady, padx ,ipady ,ipadx this are literally use in styling like
i will make a awesome button
m=Button(root,text="hi",bg="green",borderwidth="10",relief=GROOVE,font="Times 15 bold italic").pack(pady=20,ipady=4,ipadx=20)
now we use some types of relief in this button
m=Button(root,text="hi",bg="green",borderwidth="10",relief=FLAT,font="Times 15 bold italic").pack(pady=20,ipady=4,ipadx=20)
m=Button(root,text="hi",bg="green",borderwidth="10",relief=SUNKEN,font="Times 15 bold italic").pack(pady=20,ipady=4,ipadx=20)
m=Button(root,text="hi",bg="green",borderwidth="10",relief=RAISED,font="Times 15 bold italic").pack(pady=20,ipady=4,ipadx=20)
m=Button(root,text="hi",bg="green",borderwidth="10",relief=RIDGE,font="Times 15 bold italic").pack(pady=20,ipady=4,ipadx=20)
to be continue....(reading data from buttons)
No comments:
Post a Comment