[R] grDevices::bringToTop is documented but not available: A bug?
There is help for grDevices::bringToTop but the function is not present. bringToTop() Error in bringToTop() : could not find function "bringToTop" grDevices::bringToTop() Error: 'bringToTop' is not an exported object from 'namespace:grDevices' getAnywhere(bringToTop) no object named bringToTop was found # help output: ?bringToTop bringToTop package:grDevices R Documentation Assign Focus to a Window ... etc Is this considered a bug? (first time posting; hope I did this right) sessionInfo: R version 4.4.2 (2024-10-31) Platform: x86_64-pc-linux-gnu Running under: Ubuntu 20.04.6 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: America/Los_Angeles tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.4.2 Output from "library(help=grDevices)" Information on package grDevices Description: Package:grDevices Version:4.4.2 Priority: base Title: The R Graphics Devices and Support for Colours and Fonts Author: R Core Team and contributors worldwide Maintainer: R Core Team Contact:R-help mailing list Description:Graphics devices and support for base and grid graphics. License:Part of R 4.4.2 Suggests: KernSmooth NeedsCompilation: yes Built: R 4.4.2; x86_64-pc-linux-gnu; 2024-11-04 01:29:04 UTC; unix __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [tcltk] binding two functions to one event
Thank you very much for your solution. It works for regular X events also. It never occurred to me that the argument to bind could be anything but a procedure name. Quoting peter dalgaard : This is in the obscure corners of the tcltk interface, as I am sure you already realized... I'm not even sure whether the "+" in bind +script is syntactically an operator or part of the command. However, it is usually not right to define named functions on the Tcl side and mix them with the ones R/Tcl interface generate. So I am thinking that if tkbind('all','<>',evresp1) works, then to add evresp2, you just need to get a "+" into whatever the evresp2 gets converted to. And... tkbind('all','<>',evresp1) tkbind('all','<>',paste0("+", .Tcl.callback(evresp2))) tkevent.generate(wtop,'<>',data='abcdef') evresp1 abcdef evresp2 abcdef tkbind('all','<>') R_call 0x7f9769c764b0 %d R_call 0x7f9769c79978 %d -pd PS. To answer my own question: yes, the "+" is part of the command because this does not work: tkbind('all','<>',"+", evresp2) Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] wrong # args: should be "bind window ?pattern? ?command?". On 20 Jan 2025, at 02:51 , re...@meer.net wrote: Here is some tcl/tk code I am trying to emulate in R. Paste the following into wish ### begin tcl code toplevel .wtop proc evresp1 { data } { puts "evresp1 $data" } proc evresp2 { data } { puts "evresp2 $data" } bind all <> "evresp1 %d" ### end tcl code Now paste event generate .wtop <> -data abcdef I see the output evresp1 abcdef evresp2 abcdef Both evresp1 and evresp2 got called in response to the event and both got the data. Then paste the following into an R session ### begin R code library(tcltk) catn = function(...) { cat(...,'\n') } wtop = tktoplevel() evresp1 = function(d) { catn('evresp1',d) } evresp2 = function(d) { catn('evresp2',d) } tkbind('all','<>',evresp1) .Tcl(paste('proc evresp2 { d } { ', .Tcl.callback(evresp2),'}')) .Tcl('bind all <> "+evresp2 %d"') ### end R code The .Tcl() calls are necessary (as far as I can tell) to get the effect of 'bind all <> "+evresp2 %d"' ,i.e. appending evresp2 Now paste I see output evresp1 abcdef evresp2 %d Both evresp1 and evresp2 got called but only evresp1 got the data right. How can I fix this? sessionInfo R version 4.3.0 (2023-04-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 LTS attached base packages: [1] tcltk stats graphics grDevices utils datasets methods [8] base loaded via a namespace (and not attached): [1] compiler_4.3.0 tclVersion() [1] "8.6.10" __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [tcltk] binding two functions to one event
Here is some tcl/tk code I am trying to emulate in R. Paste the following into wish ### begin tcl code toplevel .wtop proc evresp1 { data } { puts "evresp1 $data" } proc evresp2 { data } { puts "evresp2 $data" } bind all <> "evresp1 %d" bind all <> "+evresp2 %d" ### end tcl code Now paste event generate .wtop <> -data abcdef I see the output evresp1 abcdef evresp2 abcdef Both evresp1 and evresp2 got called in response to the event and both got the data. Then paste the following into an R session ### begin R code library(tcltk) catn = function(...) { cat(...,'\n') } wtop = tktoplevel() evresp1 = function(d) { catn('evresp1',d) } evresp2 = function(d) { catn('evresp2',d) } tkbind('all','<>',evresp1) .Tcl(paste('proc evresp2 { d } { ', .Tcl.callback(evresp2),'}')) .Tcl('bind all <> "+evresp2 %d"') ### end R code The .Tcl() calls are necessary (as far as I can tell) to get the effect of 'bind all <> "+evresp2 %d"' ,i.e. appending evresp2 Now paste tkevent.generate(wtop,'<>',data='abcdef') I see output evresp1 abcdef evresp2 %d Both evresp1 and evresp2 got called but only evresp1 got the data right. How can I fix this? sessionInfo R version 4.3.0 (2023-04-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 LTS attached base packages: [1] tcltk stats graphics grDevices utils datasets methods [8] base loaded via a namespace (and not attached): [1] compiler_4.3.0 tclVersion() [1] "8.6.10" __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.