I would like to scale an image according to the size of a frame that is not the toplevel, for that I'm trying to get the geometry of said frame and re-plot the image according to the results that will be returned. At the moment I'm trying only to get the geometry like the code bellow:
require(tcltk) || stop("tcltk support is absent")
# Main Window
base <- tktoplevel(padx=20, pady=20)
# Change title using tk window manager
tkwm.title(base,'Test App')
# Main Window Frame
main_frame <- tkframe(base)
tools_frame <- tkframe(main_frame)
label <- "Tools Frame"
lab_tools <- tklabel(tools_frame,text=label,width=80)
tkpack(tools_frame,lab_tools)
body_frame <- tkframe(main_frame)
bd_left_frame <- tkframe(body_frame, padx=5, pady=5)
bd_left_label <- tklabel(bd_left_frame, text='Left Body Frame')
tkpack(bd_left_frame, bd_left_label)
tkpack(body_frame, bd_left_frame, side='left', anchor='n', expand=1, fill='both')
bd_right_frame <- tkframe(body_frame, padx=5, pady=5)
bd_right_frame_a <- tkframe(bd_right_frame)
bd_right_label_a <- tklabel(bd_right_frame_a, text='Right Frame A')
tkpack(bd_right_frame_a, bd_right_label_a)
tkpack(bd_right_frame, bd_right_frame_a)
bd_right_frame_b <- tkframe(bd_right_frame)
bd_right_label_b <- tklabel(bd_right_frame_b, text='Right Frame B')
tkpack(bd_right_frame_b, bd_right_label_b)
tkpack(bd_right_frame, bd_right_frame_b)
tkpack(body_frame, bd_right_frame, side='right', anchor='n', expand=1, fill='both')
tkpack(main_frame, tools_frame)
tkpack(main_frame, body_frame)
# CALLBACKS
onResize <- function() {
geo <- tkwm.geometry(bd_right_frame_b)
print(geo)
}
# Window Event Binds
tkbind(base, '<Configure>', onResize)
tkwait.window(main_frame)
The thing is, it won't work with non top level frames, how could I do this instead?