Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Gtk2 File Selection

by phenom (Chaplain)
on Jul 27, 2007 at 02:21 UTC ( #629042=note: print w/ replies, xml ) Need Help??


in reply to Gtk2 File Selection

This should work:

my $file; my $dialog = Gtk2::FileChooserDialog->new( 'Select a File', undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok', ); if ( "ok" eq $dialog->run ) { $file = $dialog->get_filename; print "file = $file\n"; } $dialog->destroy;
See the documentation page for more: FileChooserDialog.


Comment on Re: Gtk2 File Selection
Download Code
Replies are listed 'Best First'.
Re^2: Gtk2 File Selection
by Cheater (Novice) on Jul 27, 2007 at 03:32 UTC
    That code worked perfect. I have one last question. How can I make it so the user can only select files of a certain format (i.e. only image files)?
      you reject his choice, and re-present the dialog

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://629042]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2015-07-28 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls