Posted to tcl by patthoyts at Mon Apr 21 10:33:49 GMT 2008view raw

  1. proc ::tk::console::ChooseFont {} {
  2. variable fontChooser
  3. if {[llength [info command ::tk_chooseFont]] == 0} {
  4. return
  5. }
  6.  
  7. if {[dict get $fontChooser action] eq "show"} {
  8. ::tk::choosefont configure \
  9. -parent .console \
  10. -font TkConsoleFont \
  11. -command [namespace code [list ApplyFont]]
  12. ::tk::choosefont show
  13. if {[set index [dict get $fontChooser index]] != -1} {
  14. .menubar.edit entryconfigure $index -label [msgcat::mc "Hide Fonts"]
  15. dict set fontChooser action "hide"
  16. }
  17. } else {
  18. ::tk::choosefont hide
  19. if {[set index [dict get $fontChooser index]] != -1} {
  20. .menubar.edit entryconfigure $index -label [msgcat::mc "Show Fonts"]
  21. dict set fontChooser action "show"
  22. }
  23. }
  24. }
  25. proc ::tk::console::ApplyFont {font} {
  26. font configure TkConsoleFont {*}[font actual $font]
  27. }