[R] tcltk again

Richard Müller r.mueller at oeko-sorpe.de
Sun Dec 30 17:51:33 CET 2007


> > ...
> > I experimented with tkgetSaveFile(). But in the moment the user
> > gives the
> > filename the file is not yet generated! And I can't generate it in
> > advance,
> > because the filename is not yet specified.
>
> I don't see why this is a problem. In tkgetSaveFile(), the user can
> just navigate to the correct directory and then type a filename in.
> Then that would be returned. The following worked over here:
>
> x<-tkgetSaveFile()
> #.. go to right directory and type in filename
> tclvalue(x)
Thank you, Charilaos, for your posting.
I wrote the following:
--------------------------------------------------
require(tcltk)
#Tcl/Tk - Texteingabe
Datei <- tkgetSaveFile(initialdir="temp/",defaultextension=".pdf",
initialfile="Haupt_Chl_ Phaeo.pdf")
fileName <- tclvalue(Datei)
pdf(fileName) # graphical device driver with filename
...(code for the graphics)...
---------------------------------------------------
As expected, I get an empty pdf-file. Specifying the pdf-device-driver results 
in automatically saving the generated pdf. The tkGetSave-function isn't 
helpful in this case. I must have the possibility to input a filename and 
then give this filename as an argument to the device-driver.
Richard

-- 
Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn
www.oeko-sorpe.de



More information about the R-help mailing list