gtk.FileChooserDialog

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

gtk.FileChooserDialog

Calle Erlandsson
I don't really get the hang on how to use them... I think the reference
lack information on this area :(
Can somebody help me?
I want a gtk.FileChooserDialog that i can get a list of URI's from.
How do I construct one?

--

Helmutt

_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Reply | Threaded
Open this post in threaded view
|

Re: gtk.FileChooserDialog

Nikos Kouremenos
On 5/29/05, Calle Erlandsson <[hidden email]> wrote:
> I don't really get the hang on how to use them... I think the reference
> lack information on this area :(
> Can somebody help me?
> I want a gtk.FileChooserDialog that i can get a list of URI's from.
> How do I construct one?

dialog = gtk.FileChooserDialog(_('Choose Sound'), None,
                                        gtk.FILE_CHOOSER_ACTION_OPEN,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_OPEN, gtk.RESPONSE_OK))
                dialog.set_default_response(gtk.RESPONSE_OK)

                filter = gtk.FileFilter()
                filter.set_name(_('All files'))
                filter.add_pattern('*')
                dialog.add_filter(filter)

                filter = gtk.FileFilter()
                filter.set_name(_('Wav Sounds'))
                filter.add_pattern('*.wav')
                dialog.add_filter(filter)
                dialog.set_filter(filter)

                file = os.path.join(os.getcwd(), file)
                dialog.set_filename(file)
                file = ''
                response = dialog.run()
                        if response != gtk.RESPONSE_OK:
                                 print 'be'
                        file = dialog.get_filename()
                        if os.path.exists(file):
                                  print 'boo'
                dialog.destroy()

adjust to your needs
--
Nikos Kouremenos | Jabber ID: [hidden email] | http://members.hellug.gr/nkour
_______________________________________________
pygtk mailing list   [hidden email]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/