Version 1 of Add tk fontchooser Dialogue To tkcon prefrences menu

Updated 2014-08-04 08:59:09 by Superlinux

Hi.

I know many finds it hard to change tkcon console font the first time they use it if they are not told that tkcon has command line options. One of the options is the -font .

Today, I edited the script of tkcon.tcl to let it use the command tk fontchooser . It helps you choose the font you like for the widget/window path you want.

So, this is what you should do:

  • Open and edit the file /usr/bin/tkcon using any text editor.
  • Inside the namespace ::tkcon , make a space around line 85, that's just before the line containing ## ::tkcon::Init - inits tkcon, to add the following procedure:
proc ::tkcon::fontchooserFontSelection {w font args} {

    $w configure -font [font actual $font]
}
  • Search and look now where it talks about adding menu items in the prefs menu . It's around line 1590. You should find a comment saying ## Prefs Menu.
  • Below it, there is a foreach m list [menu $w.prefs [menu $w.pop.prefs] loop . Inside this foreach loop add the following menu item:
$m add command -label "Console Font" -command {
           tk fontchooser show
           tk fontchooser configure -font [ $::tkcon::PRIV(console) cget -font ] \
            -command [list ::tkcon::fontchooserFontSelection $::tkcon::PRIV(console)]
           }
  * Save the file and restart tkcon. You should find a new menu item in the ''prefs'' menu named ''Console Font''. Enjoy!