Checkbutton to set font to bold : Font : 2D PYTHON examples


PYTHON examples » 2D » Font »

 

Checkbutton to set font to bold


Checkbutton to set font to bold

from Tkinter import *

class CheckFontFrame ):
   def __init__self ):
      Frame.__init__self )
      self.packexpand = YES, fill = BOTH )
      self.master.title"Checkbutton Demo" )   
      
      self.frame1 = Frameself )
      self.frame1.pack()
      
      self.text = Entryself.frame1, width = 40,
         font = "Arial 10" )
      self.text.insertINSERT, "Watch the font style change" )
      self.text.packpadx = 5, pady = )

      self.frame2 = Frameself )
      self.frame2.pack()
      
      self.boldOn = BooleanVar()

      self.checkBold = Checkbuttonself.frame2, text = "Bold"
         variable = self.boldOn, command = self.changeFont )
      self.checkBold.packside = LEFT, padx = 5, pady = )

   def changeFontself ):
      desiredFont = "Arial 10"
      if self.boldOn.get():
         desiredFont += " bold"

      self.text.configfont = desiredFont )

def main():
   CheckFont().mainloop()

if __name__ == "__main__":
   main()


           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo 2D
» Font