Using Eto OpenFileDialog

Hi Dale

I have tried using Eto.Forms.OpenFileDialog like your code above but in Python instead, Unfortunately, when the file dialog pops up by using Forms.FilePicker that doesn’t have any filter option. How can I solve it, Thanks!
This is my code :
self.fd = forms.OpenFileDialog
filter = forms.FileFilter(“CSV file”,".csv")
self.fd.Filters.Add(filter)
self.filepath = forms.FilePicker()

I’ve moved this to a new topic.

Hi @Dat_Nguyen,

How about this?

import rhinoscriptsyntax as rs
filename = rs.OpenFileName("Open", "CSV Files (*.csv)|*.csv||")
if filename: 
    rs.MessageBox(filename)

– Dale

Hi @dale,

Thanks for your response. I want to put the “input file” box into the Eto layout like this image
and then hit the browse button and see the filter option at the right hand, is it possible? or I have to use rs.OpenFileName to open the file separately from the Eto layout?

Hey @Dat_Nguyen,

If you did something like this:

self.PathTextBox = Eto.Forms.TextBox()

Then you can do this:

 def BrowseButtonClick(self, sender, e):
    filename = rs.OpenFileName("Open", "CSV Files (*.csv)|*.csv||")
    if filename: 
        self.PathTextBox.Text = filename

– Dale

2 Likes

Thanks @dale , I’ll try it!