How to get a "choose directory" dialog box using Perl Tkx on Windows 7?

715 views Asked by At

I'm trying to invoke Windows 7's "choose directory" dialog box using Perl Tkx. This is what I'm using:

my $dirname = Tkx::tk___chooseDirectory();

However, this doesn't display any dialog box, but instead causes my program to hang without providing any error messages. Am I using the function incorrectly? How do I get the dialog box to display?

Thanks for your help.

UPDATE:

I won't paste in my full script as it's too long, but simply running the following causes perl to hang for me:

use warnings;
use strict;
use Tkx;

my $dirname = Tkx::tk___chooseDirectory();
1

There are 1 answers

0
tale852150 On

Your script worked fine, without errors, using the code you provided, running under Windows 7 Professional 64-bit with ActivePerl 5.20.2 64-bit. See image below (blacked-out items are potentially sensitive data):

enter image description here

Could it be possible that the Tkx screen is being displayed behind another screen? Try running the code your provided from the MS-DOS prompt. Also, Tk.pm must be installed since Tkx is a wrapper for Tk. But I am making the assumption here that other Tkx widgets are working correctly and therefore Tk is installed correctly.

HTH