Change RGtk2 hbox height
I'm trying to add "next" and "previous" buttons to my RGtk2 layout.
I've put the "next" and "prev" buttons into their own Hbox and added them to the end of the GUI.
Unfortunately the Hbox containing these buttons expands to take up a 1/3 of the overall area of the screen, as can be seen below:
I'd like the new hbox to take up as little space as possible, to allow maximum room for the second graph. How can I shrink the height of the Hbox?
I've tried inserting the hbox using packEnd, rather than packStart and it looks exactly the same.
Here's the code:
library(RGtk2)
library(tidyr)
library(ggplot2)
library(cairoDevice)
# data generation ---------------------------------------------------------
s1 = mvrnorm(1000, c(0, 0), matrix(c(1, 0.8, 0.8, 1),2,2))
s2 = mvrnorm(1000, c(0,0), matrix( c(1,-0.8,-0.8,1),2,2))
# code --------------------------------------------------------------------
window <- gtkWindow(show = FALSE)
frame_main <- gtkFrameNew("test")
window$add(frame_main)
graphics_old <- gtkDrawingArea()
graphics_new <- gtkDrawingArea()
button_next = gtkButtonNewWithLabel("Next")
button_prev = gtkButtonNewWithLabel("Previous")
button_test = gtkButtonNewWithLabel("test")
button_reset = gtkButtonNewWithLabel("Reset")
textbox_example<- gtkEntryNew()
textbox_example$setWidthChars(100)
label = gtkLabelNewWithMnemonic("Input your text here")
vbox_1 = gtkVBoxNew()
vbox_1$setBorderWidth(10)
vbox_1$packStart(graphics_old, expand = TRUE, fill = TRUE, padding = 0)
vbox_1$packStart(label,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(textbox_example,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(button_test,expand = FALSE, fill = FALSE, padding = 0)
frame_main$add(vbox_1)
vbox_2 = gtkVBoxNew()
vbox_2$packStart(graphics_new, expand = TRUE, fill = TRUE, padding = 0)
vbox_2$packStart(button_reset,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(vbox_2)
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = TRUE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = TRUE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
window$setDefaultSize(1000,1000)
window$showAll()
asCairoDevice(graphics_old)
plot(s1)
asCairoDevice(graphics_new)
plot(s2)
Furthermore, there seem to be hardly any tutorials for RGtk on the internet. I've found one on R-Bloggers and one in some ancient stats paper. If you know where I can get more please let me know.
EDIT: Setting expand = FALSE
As suggested in the comments, I've set expand = FALSE. This just pushes the buttons to the left. The height of the box remains unchanged.
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = FALSE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = FALSE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
r user-interface gtk
add a comment |
I'm trying to add "next" and "previous" buttons to my RGtk2 layout.
I've put the "next" and "prev" buttons into their own Hbox and added them to the end of the GUI.
Unfortunately the Hbox containing these buttons expands to take up a 1/3 of the overall area of the screen, as can be seen below:
I'd like the new hbox to take up as little space as possible, to allow maximum room for the second graph. How can I shrink the height of the Hbox?
I've tried inserting the hbox using packEnd, rather than packStart and it looks exactly the same.
Here's the code:
library(RGtk2)
library(tidyr)
library(ggplot2)
library(cairoDevice)
# data generation ---------------------------------------------------------
s1 = mvrnorm(1000, c(0, 0), matrix(c(1, 0.8, 0.8, 1),2,2))
s2 = mvrnorm(1000, c(0,0), matrix( c(1,-0.8,-0.8,1),2,2))
# code --------------------------------------------------------------------
window <- gtkWindow(show = FALSE)
frame_main <- gtkFrameNew("test")
window$add(frame_main)
graphics_old <- gtkDrawingArea()
graphics_new <- gtkDrawingArea()
button_next = gtkButtonNewWithLabel("Next")
button_prev = gtkButtonNewWithLabel("Previous")
button_test = gtkButtonNewWithLabel("test")
button_reset = gtkButtonNewWithLabel("Reset")
textbox_example<- gtkEntryNew()
textbox_example$setWidthChars(100)
label = gtkLabelNewWithMnemonic("Input your text here")
vbox_1 = gtkVBoxNew()
vbox_1$setBorderWidth(10)
vbox_1$packStart(graphics_old, expand = TRUE, fill = TRUE, padding = 0)
vbox_1$packStart(label,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(textbox_example,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(button_test,expand = FALSE, fill = FALSE, padding = 0)
frame_main$add(vbox_1)
vbox_2 = gtkVBoxNew()
vbox_2$packStart(graphics_new, expand = TRUE, fill = TRUE, padding = 0)
vbox_2$packStart(button_reset,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(vbox_2)
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = TRUE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = TRUE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
window$setDefaultSize(1000,1000)
window$showAll()
asCairoDevice(graphics_old)
plot(s1)
asCairoDevice(graphics_new)
plot(s2)
Furthermore, there seem to be hardly any tutorials for RGtk on the internet. I've found one on R-Bloggers and one in some ancient stats paper. If you know where I can get more please let me know.
EDIT: Setting expand = FALSE
As suggested in the comments, I've set expand = FALSE. This just pushes the buttons to the left. The height of the box remains unchanged.
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = FALSE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = FALSE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
r user-interface gtk
1
You have set the buttons to expand, try settingexpand = False
.
– theGtknerd
Nov 15 '18 at 22:53
@theGtknerd Thanks. I've tried this but it just pushed the buttons to the left of the box. I've added a screenshot.
– RNs_Ghost
Nov 16 '18 at 9:04
Is itvbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
then?
– theGtknerd
Nov 16 '18 at 12:30
If this worked for you, please post an answer for other people coming here. Or let me know that it worked and I can post an answer.
– theGtknerd
Nov 18 '18 at 21:06
Hi, thank you please add it as an answer and I'll mark it as correct.
– RNs_Ghost
Nov 18 '18 at 23:06
add a comment |
I'm trying to add "next" and "previous" buttons to my RGtk2 layout.
I've put the "next" and "prev" buttons into their own Hbox and added them to the end of the GUI.
Unfortunately the Hbox containing these buttons expands to take up a 1/3 of the overall area of the screen, as can be seen below:
I'd like the new hbox to take up as little space as possible, to allow maximum room for the second graph. How can I shrink the height of the Hbox?
I've tried inserting the hbox using packEnd, rather than packStart and it looks exactly the same.
Here's the code:
library(RGtk2)
library(tidyr)
library(ggplot2)
library(cairoDevice)
# data generation ---------------------------------------------------------
s1 = mvrnorm(1000, c(0, 0), matrix(c(1, 0.8, 0.8, 1),2,2))
s2 = mvrnorm(1000, c(0,0), matrix( c(1,-0.8,-0.8,1),2,2))
# code --------------------------------------------------------------------
window <- gtkWindow(show = FALSE)
frame_main <- gtkFrameNew("test")
window$add(frame_main)
graphics_old <- gtkDrawingArea()
graphics_new <- gtkDrawingArea()
button_next = gtkButtonNewWithLabel("Next")
button_prev = gtkButtonNewWithLabel("Previous")
button_test = gtkButtonNewWithLabel("test")
button_reset = gtkButtonNewWithLabel("Reset")
textbox_example<- gtkEntryNew()
textbox_example$setWidthChars(100)
label = gtkLabelNewWithMnemonic("Input your text here")
vbox_1 = gtkVBoxNew()
vbox_1$setBorderWidth(10)
vbox_1$packStart(graphics_old, expand = TRUE, fill = TRUE, padding = 0)
vbox_1$packStart(label,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(textbox_example,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(button_test,expand = FALSE, fill = FALSE, padding = 0)
frame_main$add(vbox_1)
vbox_2 = gtkVBoxNew()
vbox_2$packStart(graphics_new, expand = TRUE, fill = TRUE, padding = 0)
vbox_2$packStart(button_reset,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(vbox_2)
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = TRUE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = TRUE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
window$setDefaultSize(1000,1000)
window$showAll()
asCairoDevice(graphics_old)
plot(s1)
asCairoDevice(graphics_new)
plot(s2)
Furthermore, there seem to be hardly any tutorials for RGtk on the internet. I've found one on R-Bloggers and one in some ancient stats paper. If you know where I can get more please let me know.
EDIT: Setting expand = FALSE
As suggested in the comments, I've set expand = FALSE. This just pushes the buttons to the left. The height of the box remains unchanged.
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = FALSE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = FALSE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
r user-interface gtk
I'm trying to add "next" and "previous" buttons to my RGtk2 layout.
I've put the "next" and "prev" buttons into their own Hbox and added them to the end of the GUI.
Unfortunately the Hbox containing these buttons expands to take up a 1/3 of the overall area of the screen, as can be seen below:
I'd like the new hbox to take up as little space as possible, to allow maximum room for the second graph. How can I shrink the height of the Hbox?
I've tried inserting the hbox using packEnd, rather than packStart and it looks exactly the same.
Here's the code:
library(RGtk2)
library(tidyr)
library(ggplot2)
library(cairoDevice)
# data generation ---------------------------------------------------------
s1 = mvrnorm(1000, c(0, 0), matrix(c(1, 0.8, 0.8, 1),2,2))
s2 = mvrnorm(1000, c(0,0), matrix( c(1,-0.8,-0.8,1),2,2))
# code --------------------------------------------------------------------
window <- gtkWindow(show = FALSE)
frame_main <- gtkFrameNew("test")
window$add(frame_main)
graphics_old <- gtkDrawingArea()
graphics_new <- gtkDrawingArea()
button_next = gtkButtonNewWithLabel("Next")
button_prev = gtkButtonNewWithLabel("Previous")
button_test = gtkButtonNewWithLabel("test")
button_reset = gtkButtonNewWithLabel("Reset")
textbox_example<- gtkEntryNew()
textbox_example$setWidthChars(100)
label = gtkLabelNewWithMnemonic("Input your text here")
vbox_1 = gtkVBoxNew()
vbox_1$setBorderWidth(10)
vbox_1$packStart(graphics_old, expand = TRUE, fill = TRUE, padding = 0)
vbox_1$packStart(label,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(textbox_example,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(button_test,expand = FALSE, fill = FALSE, padding = 0)
frame_main$add(vbox_1)
vbox_2 = gtkVBoxNew()
vbox_2$packStart(graphics_new, expand = TRUE, fill = TRUE, padding = 0)
vbox_2$packStart(button_reset,expand = FALSE, fill = FALSE, padding = 0)
vbox_1$packStart(vbox_2)
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = TRUE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = TRUE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
window$setDefaultSize(1000,1000)
window$showAll()
asCairoDevice(graphics_old)
plot(s1)
asCairoDevice(graphics_new)
plot(s2)
Furthermore, there seem to be hardly any tutorials for RGtk on the internet. I've found one on R-Bloggers and one in some ancient stats paper. If you know where I can get more please let me know.
EDIT: Setting expand = FALSE
As suggested in the comments, I've set expand = FALSE. This just pushes the buttons to the left. The height of the box remains unchanged.
vbox_3 = gtkHBoxNew()
vbox_3$packStart(button_next, expand = FALSE,fill = FALSE, padding = 0)
vbox_3$packStart(button_prev, expand = FALSE,fill = FALSE, padding = 0)
vbox_2$packStart(vbox_3)
r user-interface gtk
r user-interface gtk
edited Nov 16 '18 at 9:03
RNs_Ghost
asked Nov 15 '18 at 15:38
RNs_GhostRNs_Ghost
66541431
66541431
1
You have set the buttons to expand, try settingexpand = False
.
– theGtknerd
Nov 15 '18 at 22:53
@theGtknerd Thanks. I've tried this but it just pushed the buttons to the left of the box. I've added a screenshot.
– RNs_Ghost
Nov 16 '18 at 9:04
Is itvbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
then?
– theGtknerd
Nov 16 '18 at 12:30
If this worked for you, please post an answer for other people coming here. Or let me know that it worked and I can post an answer.
– theGtknerd
Nov 18 '18 at 21:06
Hi, thank you please add it as an answer and I'll mark it as correct.
– RNs_Ghost
Nov 18 '18 at 23:06
add a comment |
1
You have set the buttons to expand, try settingexpand = False
.
– theGtknerd
Nov 15 '18 at 22:53
@theGtknerd Thanks. I've tried this but it just pushed the buttons to the left of the box. I've added a screenshot.
– RNs_Ghost
Nov 16 '18 at 9:04
Is itvbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
then?
– theGtknerd
Nov 16 '18 at 12:30
If this worked for you, please post an answer for other people coming here. Or let me know that it worked and I can post an answer.
– theGtknerd
Nov 18 '18 at 21:06
Hi, thank you please add it as an answer and I'll mark it as correct.
– RNs_Ghost
Nov 18 '18 at 23:06
1
1
You have set the buttons to expand, try setting
expand = False
.– theGtknerd
Nov 15 '18 at 22:53
You have set the buttons to expand, try setting
expand = False
.– theGtknerd
Nov 15 '18 at 22:53
@theGtknerd Thanks. I've tried this but it just pushed the buttons to the left of the box. I've added a screenshot.
– RNs_Ghost
Nov 16 '18 at 9:04
@theGtknerd Thanks. I've tried this but it just pushed the buttons to the left of the box. I've added a screenshot.
– RNs_Ghost
Nov 16 '18 at 9:04
Is it
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
then?– theGtknerd
Nov 16 '18 at 12:30
Is it
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
then?– theGtknerd
Nov 16 '18 at 12:30
If this worked for you, please post an answer for other people coming here. Or let me know that it worked and I can post an answer.
– theGtknerd
Nov 18 '18 at 21:06
If this worked for you, please post an answer for other people coming here. Or let me know that it worked and I can post an answer.
– theGtknerd
Nov 18 '18 at 21:06
Hi, thank you please add it as an answer and I'll mark it as correct.
– RNs_Ghost
Nov 18 '18 at 23:06
Hi, thank you please add it as an answer and I'll mark it as correct.
– RNs_Ghost
Nov 18 '18 at 23:06
add a comment |
1 Answer
1
active
oldest
votes
The bottom box with the two buttons was set by default to expand. To set it to take minimal space use:
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322919%2fchange-rgtk2-hbox-height%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The bottom box with the two buttons was set by default to expand. To set it to take minimal space use:
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
add a comment |
The bottom box with the two buttons was set by default to expand. To set it to take minimal space use:
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
add a comment |
The bottom box with the two buttons was set by default to expand. To set it to take minimal space use:
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
The bottom box with the two buttons was set by default to expand. To set it to take minimal space use:
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
answered Nov 18 '18 at 23:17
theGtknerdtheGtknerd
2,0921721
2,0921721
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322919%2fchange-rgtk2-hbox-height%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You have set the buttons to expand, try setting
expand = False
.– theGtknerd
Nov 15 '18 at 22:53
@theGtknerd Thanks. I've tried this but it just pushed the buttons to the left of the box. I've added a screenshot.
– RNs_Ghost
Nov 16 '18 at 9:04
Is it
vbox_2$packStart(vbox_3, expand = FALSE, fill = FALSE, 0)
then?– theGtknerd
Nov 16 '18 at 12:30
If this worked for you, please post an answer for other people coming here. Or let me know that it worked and I can post an answer.
– theGtknerd
Nov 18 '18 at 21:06
Hi, thank you please add it as an answer and I'll mark it as correct.
– RNs_Ghost
Nov 18 '18 at 23:06