Checkbuttons demonstration : Font : 2D PYTHON examples


PYTHON examples » 2D » Font »

 

Checkbuttons demonstration


Checkbuttons demonstration: set font

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, "font style" )
      self.text.packpadx = 5, pady = )

      self.frame2 = Frameself )
      self.frame2.pack()
      
      create boolean variable
      self.italicOn = BooleanVar()

      create "Italic" checkbutton
      self.checkItalic = Checkbuttonself.frame2, 
         text = "Italic", variable = self.italicOn, 
         command = self.changeFont )
      self.checkItalic.packside = LEFT, padx = 5, pady = )

   def changeFontself ):
      desiredFont = "Arial 10"

      if self.italicOn.get():
         desiredFont += " italic"

      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