Skip to content
Prev 51051 / 63424 Next

Link R with Tcl 8.6 on Windows

OK, I have the answers to my questions:

The GUI error in Windows happens for the sequence: create a toplevel in 
Tcl, set an icon, pack something. A small self contained example is:

library(tcltk)

.Tcl("

     set icon [image create photo -width 30 -height 20]

     $icon put blue -to 0 0 30 20; $icon put yellow -to 0 6 30 11



      proc foo {} {

         set i 0

         while {[winfo exists .w$i]} {

             incr i

         }

         toplevel .w$i

         wm iconphoto .w$i $::icon

         canvas .w$i.c -bg steelblue

         pack .w$i.c -fill both -expand TRUE

      }

   ")



.Tcl('foo')

Not setting the icon or replacing the "toplevel .w$i" command with the 
tktoplevel() R callback will fix the problem.

As for linking Tcl version 8.6 with R under Windows: I have compiled R 
against ActiveTcl version 8.6 which works without the necessity of 
copying and renaming the dlls. So far, ActiveTcl 8.6 works well.

Adrian
On 2015-09-28 07:36 PM, Adrian Waddell wrote: