0

I'm using Glade and GTK3 to build my Python 3 UI, and am using a GtkFileChooserDialog to select a file. But this dialog, even though my Action is set to Open, is allowing me to select folders as well. If I double-click on a folder, it opens it and allows me to search further for my file. But if I have a folder selected and type Enter or click the OK button, it returns that folder name. I want it to ONLY be able to return a file with a particular extension.

I see other posts where they have a hard time allowing selection of either a file or a folder, and most solutions talk about adding another button. But here I'm getting that behavior but don't want it.

Before I transferred my program over to a Glade interface I got the desired behavior. So is there some setting in Glade that I need to tweak to NOT return folders from my chooser? I can't seem to find it.

Jeff H
  • 915
  • 1
  • 6
  • 11
  • Note that I can go back to the non-Glade way of running the dialog (and that's the way I currently have it in the code, to get the desired behavior), but what's the point of defining FileChooserDialogs in Glade if you don't have sufficient control over them? – Jeff H Jun 01 '19 at 11:58
  • If you have some code, which makes folders not OKable, you can apply it to the widget you get from `.ui`. By the way, can you add your current code to the question? – Alexander Dmitriev Jun 01 '19 at 19:31

0 Answers0