Created
July 6, 2012 22:27
-
-
Save spacedman/3063106 to your computer and use it in GitHub Desktop.
Resizing rpanel widgets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# here is a way to make an rpanel dialog wider. Useful when the default skinny | |
# sliders are not precise enough for fat fingered prodders: | |
# standard slider demo | |
density.draw <- function(panel) { | |
plot(density(panel$x, bw = panel$h)) | |
panel | |
} | |
# create panel and add slider. Note aschar=FALSE so we can get the $window: | |
panel <- rp.control(x = rnorm(50),aschar=FALSE) | |
rp.slider(panel, h, 0.5, 5, log = TRUE, action = density.draw) | |
# construct a geometry string with the current height and new width: | |
h = as.numeric(tkwinfo("height",panel$window)) | |
w = 300 | |
g = sprintf("%dx%d",w,h) | |
# resize | |
tkwm.geometry(panel$window,g) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment