I am using Tkinter
with Python 2.6
and 2.7
for programming graphic user interfaces.
These User Interfaces contain dialogs for
I had to get rid of the canvasx/y statements. That line now simply reads set item [$data(canvas) find closest $x $y]
, which works well. $data(canvas) canvasx $x
for its own works well but not in connection with find closest
, neither if it is written in two lines.
call
method is defined in _tkinter.c, but there is nothing interesting for your particular task there. It just calls a Tcl command, and the command tk_getSaveFile
does all the work.
And yes, when there is a native file dialog on the operating system, tk_getSaveFile
uses them (e.g. GetSaveFileName
is used on Windows). It could be possible to add widgets there, but not without tampering with C sources of Tk. If you're sure that your target uses non-native Tk dialogs, you could add something to its widget hierarchy by hacking ::tk::dialog::file::
procedure from Tk (see library/tkfbox.tcl
).
I would rather take an alternative implementation of tk_getSaveFile, written in pure Tcl/Tk and never using the OS facility. This way, we can be sure that its layout is the same for all OSes, and it won't suddenly change with a new version of Tk. It's still far from trivial to provide a convenient API for python around it, but at least, it is possible.