[R] Copy & Paste from tktext on Mac

David Winsemius dwinsemius at comcast.net
Mon Aug 24 15:21:53 CEST 2009

On Aug 24, 2009, at 8:21 AM, Anne Skoeries wrote:

> Hi there,
> a text Window is supposed to map the shortcuts for copying and  
> pasting (<Ctrl-C>, <Ctrl-V>) automatically.
> I'm working under Mac OS X and my text window doesn't really map  
> these functions automatically - it works fine under Windows.

That is a bit vague. When discussing user interface behavior, it would  
make sense to be more explicit about keystrokes. It's not clear here  
that you aware that the Mac (which did start delivering this GUI  
pizzazz long before MS-Windows was even halfway stable) uses cmd-C and  
cmd-V as the to- and from-clipboard key operations, rather than crtl-C  
and ctrl-V?

> Is there an easy way to map copy&paste functions to a text window  
> under Mac OS X?


Brings up two hits on my machine one for connections and one for  
TkCommands. The first has a section on functions to access the  
Clipboard from R.  The second help page should appear if you have  
tcltk loaded, although I don't at the moment so I cannot test that.

?TkCommands  # probably

There is a specific help list for Mac questions and a lot of the  
really knowledgeable people read it more regularly than r-help.

> This is what I'm doing with my text window:
> tt <- tktoplevel()
> txt <- tktext(tt, bg = "white", height=30, width=100, borderwidth=2)
> scr <- tkscrollbar(tt, orient = "vertical", repeatinterval = 1,  
> command = function(...) tkyview(txt, ...))
> tkconfigure(txt, yscrollcommand = function(...) tkset(scr, ...))
> tkgrid(txt, column=0, row=0, columnspan=2, sticky="nwse")
> Session Info:
> R version 2.9.1 (2009-06-26)
> i386-apple-darwin8.11.1
> locale:
> de_DE.UTF-8/de_DE.UTF-8/C/C/de_DE.UTF-8/de_DE.UTF-8
> attached base packages:
> [1] tcltk     stats     graphics  grDevices utils     datasets   
> methods   base
> other attached packages:
> [1] tkrplot_0.0-18 rpart_3.1-44   relimp_1.0-1
> Thanks so much!
> --
> Anne Skoeries
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list