[R] Tktable do not expand inside a Tkframe

phgrosjean at sciviews.org phgrosjean at sciviews.org
Fri Dec 4 07:45:42 CET 2015


Instead of using tkgrid(), you can do this with tkpack().

Replace:

> tkgrid( tableData, scrY )
> tkgrid.configure( scrY, sticky="nsw")
> tkgrid( scrX, sticky="new" )


by:

scrYwidth <- as.integer(tkcget(scrY, width = NULL))
tkpack(scrY, side = "right", fill = "y", expand = FALSE,
  pady = c(0, scrYwidth + 2))
tkpack(scrX, side = "bottom", fill = "x", expand = FALSE)
tkpack(tableData, fill = "both", expand = TRUE)

in your code.

Best,

Philippe Grosjean

> On 04 Dec 2015, at 02:31, Cleber N.Borges <klebyn at yahoo.com.br> wrote:
> 
> 
> 
> hello all,
> 
> I'm trying to build a table within a frame. I would like the table to
> expand when the entire window is expanded.
> I could not find examples of how to solve this problem.
> I thank you in advance for help.
> 
> Cleber
> #######################################
> # piece of the code
> 
> library( tcltk )
> tclRequire( "Tktable" )
> dataorgW <- tktoplevel()
> fmMenu <- tkframe( dataorgW, borderwidth=10, relief="groove", bg='red' )
> tkpack( fmMenu, expand=1, fill='both' )
> 
> scrX <- tkscrollbar( fmMenu, command=function(...) tkxview( tableData,
> ... ), orient="horizontal" )
> scrY <- tkscrollbar( fmMenu, command=function(...) tkyview( tableData,
> ... ), orient="vertical" )
> 
> height <- -1; width <- -1
> 
> tableData <- tkwidget( fmMenu, "table", rows=50, cols=50,
>                      titlerows=1, titlecols=1,
> height=height+1,width=width+1,
>                      xscrollcommand=function(...) tkset( scrX, ... ),
>                      yscrollcommand=function(...) tkset( scrY, ... ),
>                      rowstretch='all', colstretch='all'
>                      )
> 
> tkconfigure( tableData, multiline=0 )
> tkgrid( tableData, scrY )
> tkgrid.configure( scrY, sticky="nsw")
> tkgrid( scrX, sticky="new" )
> 
> tclarray <- tclArray()
> tkconfigure( tableData, variable=tclarray, selectmode="extended",
> background="white" )
> 
> 
> 
> 
> 
> 
> ---
> Este email foi escaneado pelo Avast antiv�rus.
> https://www.avast.com/antivirus
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list