我在 R 中创建了一个带有tcltk
包的 GUI 窗口。该窗口如下所示:
当我在窗口中添加或删除单选按钮时(通过按按钮“添加 C”或“Del A”),窗口会调整大小。
如何防止这种行为并创建一个窗口,该窗口可以包含五行单选按钮而不调整大小,并且在我删除按钮时不调整大小。
我的代码:
library(tcltk)
library(tcltk2)
top <- tktoplevel()
# Create buttons
onEXIT <- function() {tkdestroy(top)}
onDELETE <- function() {tkdestroy(buttonA)}
onADD <- function() {tkgrid(buttonC)}
butOK <- tk2button(top, text = "Exit", command = onEXIT)
butADD <- tk2button(top, text = "Add C", command = onADD)
butDELETE <- tk2button(top, text = "Del A", command = onDELETE)
tkgrid(butOK, butDELETE, butADD)
# Create radiobuttons
buttonA <- tkradiobutton(top, text = "A")
buttonB <- tkradiobutton(top, text = "B")
buttonC <- tkradiobutton(top, text = "C")
tkgrid(buttonA)
tkgrid(buttonB)