Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tab layout: extra whitespace #1307

Open
hainm opened this issue Apr 22, 2017 · 16 comments
Open

tab layout: extra whitespace #1307

hainm opened this issue Apr 22, 2017 · 16 comments
Milestone

Comments

@hainm
Copy link

hainm commented Apr 22, 2017

hi (the tittle might not be correct, feel free to update it).

Please see the whitespace in bottom right of below image.
(To be compatible with ipytwidgets master branch, you need to install development version of nglview)

tab

PS: The new UI (from jupyterlab) is very cool. cheers.

@jasongrout
Copy link
Member

Is there any way you can reproduce this problem with just standard widgets, i.e., tabs, hbox, vbox, dropdown, etc.?

@hainm
Copy link
Author

hainm commented Apr 22, 2017

Hi. I am not sure :(. I will update if find one. Thanks.

@hainm
Copy link
Author

hainm commented Apr 23, 2017

Hi @jasongrout

Please see minimal code below

names = ['General', 'Representation', 'Preference', 'Theme', 'Extra', 'Help']
tab = Tab([Box() for _ in names])
[tab.set_title(i, title) for i, title in enumerate(names)]
tab

tab

@jasongrout jasongrout added this to the 7.0 milestone Apr 24, 2017
@jasongrout
Copy link
Member

Are you talking about how the tab contents box extends beyond the tabs? Are you saying that the tab contents box should stop where the tabs stop?

@hainm
Copy link
Author

hainm commented Apr 24, 2017 via email

@jasongrout
Copy link
Member

Thanks. I think the tab contents is filling the space available by default. If we had only one tab, we'd certainly want that. If you'd like the tab box to be shorter, you can set the layout.width of the tab control. Is that sufficient control?

@jasongrout
Copy link
Member

This is also consistent with other containers, like the Accordion and Box, which expand horizontally in the available space.

@jasongrout
Copy link
Member

That said, what I saw as the issue with your screenshot is that there is a huge space between labels and controls. I can't replicate that, though:

from ipywidgets import *
names = ['General', 'Representation', 'Preference', 'Theme', 'Extra', 'Help']
tab = Tab([IntSlider(description='hi') for _ in names])
[tab.set_title(i, title) for i, title in enumerate(names)]
tab

@jasongrout
Copy link
Member

screen shot 2017-04-24 at 10 34 58 am

@hainm
Copy link
Author

hainm commented Apr 24, 2017

If you'd like the tab box to be shorter, you can set the layout.width of the tab control. Is that sufficient control?

You mean set it to 100%? Or you meant set it to be equal to tab control width?

That said, what I saw as the issue with your screenshot is that there is a huge space between labels and controls.

I think that's due to layout option I made to align labels and controls. I will wait until ipywidgets stable to spend more effort on that. But can you try to put exact control, dropdown like my image? I guess I did have a good reason to do that in the past (may be to make it look nicer).

@jasongrout
Copy link
Member

You mean set it to 100%? Or you meant set it to be equal to tab control width?

You can set it to whatever you want. 100% would give the existing behavior (unless you resize the browser, in which case it may become narrower). Setting the tab .layout.width to a specific pixel value would let you have precise control.

@jasongrout
Copy link
Member

But can you try to put exact control, dropdown like my image?

Dropdown looks fine too:

screen shot 2017-04-24 at 10 55 15 am

@hainm
Copy link
Author

hainm commented Apr 24, 2017

Hi, I should be clearer: Can you try all of them in the same tab as mine? two sliders + two dropdowns.
(I tried the default layout with v 6.0 a while ago but there was not a nice layout).

Per

Setting the tab .layout.width to a specific pixel value would let you have precise control.

I am not sure this will work with different screens.

@jasongrout
Copy link
Member

jasongrout commented Apr 24, 2017

I am not sure this will work with different screens.

Can you maybe draw a mockup of what you are wanting? I think I'm still a bit confused about what you're proposing.

Each tab in the tab bar is fixed-width (or at least has a fixed max width). The contents box fills the area, by default. The tab widget as a whole is the width of the contents box. Many tab UIs have this - the tabs across the top are not stretched across the whole tab widget. Would it help to have another box at the end of the tab bar that extends to the edge of the tab widget?

Can you try all of them in the same tab as mine?

Works fine for me on current-ish master or so.

screen shot 2017-04-24 at 11 50 27 am

@hainm
Copy link
Author

hainm commented Apr 24, 2017

Can you maybe draw a mockup of what you are wanting? I think I'm still a bit confused about what you're proposing.

Sorry. I will try to post one. Can we leave this issue open for now? I am sure I will have something updated in the future. thanks.

@jasongrout
Copy link
Member

Can we leave this issue open for now?

Of course

@jasongrout jasongrout modified the milestones: Future, 7.0 Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants