G'day Evel,
"... I also want to know what the default font style name is?"
You can use the cget() method (see Tk::options)
to determine the default option value of any widget.
You can find values quickly using a one-liner, e.g.
$ perl -E 'use Tk; say MainWindow->new->Listbox->cget("-background")'
#d9d9d9
Some option values aren't individual scalars: you may get a reference returned, e.g.
$ perl -E 'use Tk; say MainWindow->new->Listbox->cget("-font")'
Tk::Font=SCALAR(0x7f972e1bbd80)
You can just dereference as normal.
Here's two examples showing the older "${ ... }", and newer "...->$*", syntaxes.
See "perlref: Postfix Dereference Syntax"
if you're unfamiliar with the second one.
$ perl -E 'use Tk; say ${ MainWindow->new->Listbox->cget("-font") }'
Helvetica -12 bold
$ perl -E 'use Tk; say MainWindow->new->Listbox->cget("-font")->$*'
Helvetica -12 bold
Here's another example just to show different widgets have different defaults.
$ perl -E 'use Tk; say MainWindow->new->Text->cget("-font")->$*'
Courier -12
Also be aware that, while Tk has its own defaults, these may be altered externally (e.g. a .Xdefaults file);
or from within your application by a module you've loaded (e.g. a custom widget),
or by your own code (e.g. one of the "option*()" methods).
See Tk::option for details.
|