[R] Tk grid problem

peter dalgaard pdalgd at gmail.com
Mon Jul 16 17:08:18 CEST 2012


On Jul 16, 2012, at 16:13 , vincent guyader wrote:

> Hi everybody,
> 
> I have a problem with the grid function in tk.
> I juste try to put 4 buttons like this:
> 
> 
> -------------------
> |        |        |
> |        |   C    |
> |   A    |--------|
> |        |        |
> ----------   D    |
> |        |        |
> |   B    |        |
> -------------------
> 
> A is 2x2
> C is 1x2
> B is 1x2
> D is 2x2
> 
> 
> but the code bellow dont work :
> 
> 
> 
> 
> require(tcltk)
> tt <- tktoplevel(borderwidth=10)
> 
> A.but <- tkbutton(tt,text="A",command=function()ls())
> B.but <- tkbutton(tt,text="B",command=function()ls())
> C.but <- tkbutton(tt,text="C",command=function()ls())
> D.but <- tkbutton(tt,text="D",command=function()ls())
> 
> 
> tkgrid(A.but,row=1,column=1,columnspan=2,rowspan=2,sticky="nswe")
> tkgrid(B.but,row=3,column=1,columnspan=2,rowspan=1,sticky="nswe")
> tkgrid(C.but,row=1,column=3,columnspan=2,rowspan=1,sticky="wens")
> tkgrid(D.but,row=3,column=3,columnspan=2,rowspan=2,sticky="wens")
> 
> any idea?

I suspect you need to experiment with tkgrid.columnconfigure(...., minsize=...) and the corresponding for rows. Also, you probably didn't intend both B and D to start in row 3.

> 
> thx
> 
> 
> Vincent
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list