GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Aug 27, 2014 6:56 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: File Chooser Dialog
PostPosted: Tue Mar 27, 2012 8:02 pm 
Offline
Familiar Face

Joined: Tue Mar 27, 2012 7:51 pm
Posts: 6
Hi folks,
I'm newbie in this subject and I'd like to learn something new.
I have a first question: how can I get a window where the user can set a filename?
I saw something about FileChooserDialog, and I think that's correct to use it to work my problem out.

I coded:
Code:
gtk.FileChooserDialog(title="CAO", parent=None, action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=None, backend=None)


but then?
How to display it at runtime?
I'm using Python and so, Pygtk

Thanks in advance,
FrankBr


Top
 Profile  
 
 Post subject: Re: File Chooser Dialog
PostPosted: Tue Mar 27, 2012 9:07 pm 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
Yes you have the right widget. Unfortunately the PyGTK documentation is not up to scratch compared with the normal documentation for using c. This includes better descriptions and examples: http://developer.gnome.org/gtk/2.24/GtkFileChooserDialog.html. As to the se of the PyGTK version, use the gtk.FileChooser methods.


Top
 Profile  
 
 Post subject: Re: File Chooser Dialog
PostPosted: Tue Mar 27, 2012 10:29 pm 
Offline
Familiar Face

Joined: Tue Mar 27, 2012 7:51 pm
Posts: 6
I coded, but it doesn't work.

Code:
dialog=gtk.FileChooserDialog(title="CAO", parent=None, action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=None, backend=None)
   response = dialog.run()
   if response == gtk.RESPONSE_ACCEPT:
      filename = gtk.FileChooser.get_filename(dialog)
   print filename
   dialog.destroy()


Suggestions?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group