views:

38

answers:

1

I'm trying to use FileChooserDialog to get a native gnome dialog box in a python script. After the script executes, my ipython -pylab prompt experiences a significant slow down. This problem also exists from a plain python prompt. I've isolated the problem to the dialog box. The following example (which has been posted elsewhere as a pygtk example) illustrates the issue:

import pygtk
pygtk.require('2.0')
import gtk
class FileChooserDialog:
    def __init__(self):
        filechooserdialog = gtk.FileChooserDialog("FileChooserDialog Example", None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))        
        response = filechooserdialog.run()
        if response == gtk.RESPONSE_OK:
            print "Selected filepath: %s" % filechooserdialog.get_filename()
        filechooserdialog.destroy()
if __name__ == "__main__":
    FileChooserDialog()

After running the script, my hard drive light seems to flash after any key is typed in from the keyboard - very strange behavior! I do not have the problem with deprecated gtk.FileSelection or any other gtk window objects.

I'm currently running, python 2.6.5, gtk 2.21.1, pygtk 2.17.0 in ubuntu 10.04. In general this dialog seems to be flaky; I've also had some issues with the window not destroying itself when executed certain ways within scripts. Any help would be greatly appreciated!