aplonis has asked for the wisdom of the Perl Monks concerning the following question:

When I do like below on Win32, instead of getting the font path string in $foo, the font itself is displayed in a separate window. My scalar $foo remains empty.
$ttf_dir = 'C:\\WINNT\\Fonts\\'; $foo = $mw->getOpenFile( -title => 'Choose TrueType font', -initialdir => $ttf_dir, -defaultextension => '.ttf', );
How may I work around that please? I don't mind about the font display window. But I need the font path string in $foo so I can change fonts elsewhere in the script. TIA

Replies are listed 'Best First'.
Re: getOpenFile() returns empty string for TrueType font path
by saintmike (Vicar) on Feb 24, 2004 at 17:41 UTC
    Your code snippet pops up a dialog box in Perl/Tk, asking the user to select a file. If a file is selected and the "OK" button is pressed, the path to the selected file comes back in $foo. Is that what you want?
      Yes, that is exactly what I want...the file path in $foo. But on Win2K that does not happen. When I click on OK, or double-click the TTF file who's path I desire, I get instead a window of the glyphs in the font. And the string $foo remains empty. Somehow the normal behavior of getOpenFile() seems to have been diverted.