[R] tcl tk: set the position button

Karim Mezhoud kmezhoud @end|ng |rom gm@||@com
Tue Mar 14 10:40:01 CET 2023


Hi Rodrigo,
Try to add tkgrid.configuration and change values as you want.

library(tcltk2)
win1 <- tktoplevel()
butOK <- tk2button(win1, text = "TEST", width = 77)
tkgrid(whiteSPACE, butOK, columnspan=2, padx=20, pady=10)
tkgrid.configure(butOK,rowspan=2,columnspan= 3,sticky="nsew")

Here is the documentation of grid.configuration.

Or maybe try to use tkpack:

tt <- tktoplevel()
tkpack(l1 <- tklabel(tt, text = "Heave"), l2 <- tklabel(tt, text = "Ho"))
tkpack.configure(l1, side = "right")



On Mon, Mar 13, 2023 at 8:42 PM John Fox <jfox using mcmaster.ca> wrote:

> Dear Rodrigo,
>
> Try tkwm.geometry(win1, "-0+0"), which should position win1 at the top
> right.
>
> I hope this helps,
>   John
>
> --
> John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> web: https://socialsciences.mcmaster.ca/jfox/
>
> On 2023-03-12 8:41 p.m., Rodrigo Badilla wrote:
> > Hi all,
> > I am using tcltk2 library to show buttons and messages. Everything
> > work fine but I would like set the tk2button to the right of my screen,
> by default it display at the left of my screen.
> > my script example:
> > library(tcltk2) win1 <- tktoplevel() butOK <- tk2button(win1, text =
> "TEST", width = 77) tkgrid(butOK)
> > Thanks in advance
> > Saludos
> > Rodrigo
> >
> >
> > --
> > Este correo electrónico ha sido analizado en busca de virus por el
> software antivirus de Avast.
> > www.avast.com
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using 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.
>
> ______________________________________________
> R-help using 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list