# Adding a filter to open\_dialogue() in Gtk4

**URL:** <https://discourse.julialang.org/t/adding-a-filter-to-open-dialogue-in-gtk4/122994>\
**Category:** General Usage\
**Tags:** question, package, gtk4\
**Created:** [November 23, 2024, 1:59pm UTC](https://discourse.julialang.org/t/adding-a-filter-to-open-dialogue-in-gtk4/122994 "2024-11-23T13:59:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elwwan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elwwan/32/211001_2.png) [@elwwan](https://discourse.julialang.org/u/elwwan)\
**Post date:** [November 23, 2024, 1:59pm UTC](https://discourse.julialang.org/t/adding-a-filter-to-open-dialogue-in-gtk4/122994/1 "2024-11-23T13:59:41Z")

</div>

Hello, I’m trying to add a filter to a file selection.  
Here is my current code :

```julia
function on_choose_file_button_click(w)
  open_dialog("Choose Data File"; start_folder = pwd()) do filename
    global data_file_path = filename
    println("$data_file_path")
  end
end
signal_connect(on_choose_file_button_click, file_chooser, "clicked")

```

I have tried `open_dialog("Choose Data File"; start_folder = pwd() filters=[("CSV Files, "*.csv")])` but it didn’t work so I do not know what to do.

Any one know how to add a filter ?

Thanks in advance !

---

<div class="post-metadata">

**Author:** ![jwahlstrand](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jwahlstrand](https://discourse.julialang.org/u/jwahlstrand)\
**Post date:** [November 24, 2024, 1:24am UTC](https://discourse.julialang.org/t/adding-a-filter-to-open-dialogue-in-gtk4/122994/2 "2024-11-24T01:24:43Z")

</div>

This should work:

```julia
open_dialog("Choose Data File", parent_window, ["*.csv"]; start_folder = pwd()) do filename
    global data_file_path = filename
    println("$data_file_path")
end

```

I will add this to the documentation.
