Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # font_ChkBtn_demo.py
- from Tkinter import *
- itSw=['',' italic']
- bbSw=['',' bold']
- family,ffSz='Arial',' 10'
- print family+ffSz+itSw[0]+bbSw[0]
- root=Tk()
- frame1=Frame()
- frame1.pack()
- text=Entry(frame1, width=40,font="Arial 10")
- text.insert(INSERT, "sample area")
- text.pack(padx=5, pady=5)
- frame2=Frame()
- frame2.pack()
- def setText():
- text.config(font=family+ffSz+itSw[0]+bbSw[0])
- def italicSw():
- global itSw
- itSw=(itSw[1],itSw[0])
- setText()
- def boldSw():
- global bbSw
- bbSw=(bbSw[1],bbSw[0])
- setText()
- checkBold=Checkbutton(frame2, text="Bold", command=boldSw)
- checkBold.pack(side=LEFT, padx=5, pady=5)
- checkItalic=Checkbutton(frame2, text="Italic", command=italicSw)
- checkItalic.pack(side=LEFT, padx=5, pady=5)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement