Le vendredi 27 février 2015 à 10:31 -0800, Eric S a écrit :
> I see from the definition of the Messagebox function much of what I
> might do. I'm having a real problem figuring out how to define the
> filetypes however. I looked to Python's tk interface for file dialogs
> for a clue, but still got stuck.
This seems to work:
tcl("tk_getOpenFile", filetypes=["Text files {.txt}", "PNG files {.png}"])
Thus a definition like this seems to be fine:
GetOpenFile(; filetypes="") = filetypes == "" ?
tcl("tk_getOpenFile") :
tcl("tk_getOpenFile", filetypes=filetypes)
But if you want to support the other keyword arguments ( -initialdir,
-initialfile, -multiple and -title I think), you'll need a better logic,
or the number of possible combinations will explode. There's probably a
trick to avoid passing arguments which have been left to their default
value.
One might also prefer replacing "Text files {.txt}" with something more
Julian, like "Text files" => ".txt" and/or
("Text files", ".txt").
Regards
>
> Eric
>
> On Friday, February 27, 2015 at 12:06:50 PM UTC-6, Eric S wrote:
> I did see that code and tried a bit to make it work, but
> didn't get anywhere. I was clueless how to add the keywords.
> Strings? I could see it should be doable but not how to do it.
> I might be able to figure something out if I had some
> examples. I should note that I'm competent in MATLAB and
> dabble in Python but otherwise I'm not a programmer as my
> background is in Mechanical Engineering. 30 years ago I
> learned programming in FORTRAN. I've just started playing with
> Julia and I'm enjoying it. I'm hoping to displace MATLAB. I
> was into Python with Numpy/Scipy but that felt sort of bolted
> on and not as elegant. If there was someone willing to help me
> along, I could endeavor to add this functionality.
>
>
> Eric
>
> On Friday, February 27, 2015 at 10:25:20 AM UTC-6, j verzani
> wrote:
> The Tk dialogs can be redefined easily. For example,
> instead of this line
>
> (https://github.com/JuliaLang/Tk.jl/blob/master/src/dialogs.jl#L4)
>
>
> GetOpenFile() = tcl("tk_getOpenFile")
>
>
> You had
>
>
> GetOpenFile(;kwargs...) = tcl("tk_getOpenFile";
> kwargs...)
>
>
> Then you can pass in the named arguments such as
>
>
> GetOpenFile(initialdir="/tmp")
>
> You did a good job on the docs, want to put this
> together for the function definitions?
>
>
>
> On Friday, February 27, 2015 at 9:57:57 AM UTC-5, Eric
> S wrote:
>
> Tim,
>
>
> I did edit the documentation README as
> suggested. I've discovered (I think), that
> while one can call the various file dialogs,
> none of the options are supported such as
> specifying file extensions, etc. I'm gathering
> those just aren't coded yet. Is there a
> obvious way to make this request?
>
>
> Eric
>
> On Wednesday, February 25, 2015 at 12:53:41 PM
> UTC-6, Tim Holy wrote:
> Sure, just click on the source file
> (e.g., README.md) and then on the
> little
> pencil icon in the upper right hand
> corner.
>
> See also
>
> https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md
>
> Thanks for tackling this!
> --Tim
>
>
> On Wednesday, February 25, 2015
> 10:44:28 AM Eric S wrote:
> > Is there some documentation
> describing how to add to the
> documentation? I'd
> > be happy to do so if I had a clue
> how.
> >
> > Eric
> >
> > On Wednesday, February 25, 2015 at
> 10:08:41 AM UTC-6, Tim Holy wrote:
> > > It's a mix: the author has a lot
> of implicit knowledge that's s/he
> takes
> > > for
> > > granted, and that makes it harder
> to write good documentation. In
> > > combination
> > > with edits from the package
> author, a user who is just learning a
> package
> > > is
> > > the _perfect_ person to write
> documentation.
> > >
> > > The other point is that developers
> who release code are giving a gift to
> > > the
> > > community, and then being extra
> nice by answering questions on the
> mailing
> > > list. Asking the developers to do
> even more is, in a sense, asking too
> > > much.
> > > In my opinion, it's simply a fair
> exchange if the asker then takes that
> > > information that s/he has
> received, polishes it up as necessary,
> and adds
> > > it
> > > to the README. I help you, you
> help me.
> > >
> > > Converting "one answered question
> on the user list" into "one
> community-
> > > contributed improvement in the
> documentation" will go a long, long
> ways to
> > > improving the documentation for
> future users---if everyone did that,
> we
> > > would
> > > erase our documentation problems
> very quickly.
> > >
> > > --Tim
> > >
> > > On Wednesday, February 25, 2015
> 07:35:57 AM Eric S wrote:
> > > > I guess I would if I had the
> knowledge. I was hoping the author of
> the
> > > > package might help here since
> I'm assuming that person could do it
> much
> > > > more efficiently.
> > > >
> > > > Eric
> > > >
> > > > On Wednesday, February 25, 2015
> at 9:27:14 AM UTC-6, Tim Holy wrote:
> > > > > By all means, please improve
> the documentation!
> > > > >
> > > > > --Tim
> > > > >
> > > > > On Wednesday, February 25,
> 2015 07:09:33 AM Eric S wrote:
> > > > > > Thanks,
> > > > > >
> > > > > > This is exactly what I want.
> The documentation for the Tk package
> > > > >
> > > > > doesn't
> > > > >
> > > > > > list all the available
> methods/functions. There needs to be a
> more
> > > > > > discoverable method of
> finding them than asking in the user
> group.
> > > > > >
> > > > > > Eric
> > > > > >
> > > > > > On Tuesday, February 24,
> 2015 at 6:55:52 PM UTC-6, j verzani
> wrote:
> > > > > > > You can try `GetOpenFile`,
> `GetSaveFile`, or `ChooseDirectory`
> in
> > >
> > > the
> > >
> > > > > > > Tk.jl package. They all
> return a file name or "" if canceled.
> If
> > >
> > > you
> > >
> > > > > have
> > > > >
> > > > > > > other calls you want,
> these are just simple wrappers. For
> example,
> > >
> > > `
> > >
> > > > > > > GetOpenFile() =
> tcl("tk_getOpenFile")`.
> > > > > > >
> > > > > > > On Tuesday, February 24,
> 2015 at 6:56:21 PM UTC-5, Eric S
> wrote:
> > > > > > >> I did try the Tk package
> instead. The message dialog look a
> lot
> > > > >
> > > > > better,
> > > > >
> > > > > > >> but there is nothing in
> the documentation which suggests how
> to
> > >
> > > get
> > >
> > > > > at
> > > > >
> > > > > > >> Tk's
> > > > > > >> askopenfile or other
> dialogs. Any help would be
> appreciated.
> > > > > > >>
> > > > > > >> Eric
> > > > > > >>
> > > > > > >> On Tuesday, February 24,
> 2015 at 5:22:19 PM UTC-6, Eric S
> wrote:
> > > > > > >>> I'm enjoying Julia, but
> one thing I'm missing is standard
> file
> > >
> > > open
> > >
> > > > > and
> > > > >
> > > > > > >>> file save dialogs. I've
> found the Gtk package and tried that.
> It
> > > > >
> > > > > does
> > > > >
> > > > > > >>> indeed generate a file
> dialog, but it is really ugly and
> > >
> > > nonstandard
> > >
> > > > > (on
> > > > >
> > > > > > >>> OS
> > > > > > >>> X) and also generates
> the following error like messages in
> the
> > > > >
> > > > > terminal
> > > > >
> > > > > > >>> (below). Perhaps there
> is something wrong with my
> installation.
> > > > > > >>>
> > > > > > >>> Is there something like
> how R works where you can just type
> ">
> > > > > > >>> file.choose()" and a
> nice file picker dialog comes up.
> > > > > > >>>
> > > > > > >>> -Eric
> > > > > > >>>
> > > > > > >>> Gtk-Message: GtkDialog
> mapped without a transient parent.
> This
> > >
> > > is
> > >
> > > > > > >>> discouraged.
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> Gtk-WARNING **: Error loading theme
> icon
> > > > > > >>> 'image-missing' for
> stock: Icon 'image-missing' not
> present in
> > >
> > > theme
> > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_ref:
> > > assertion
> > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
> > > > >
> > > > > > >>> (<unknown>:2678):
> GLib-GObject-CRITICAL **:
> g_object_unref:
> > > > > assertion
> > > > >
> > > > > > >>> 'G_IS_OBJECT (object)'
> failed
>
>
