Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Mar 30, 2021

Fixes #3013, essentially by using our gap polyfill everywhere, not just at small resolutions. Our polyfill requires we set the width/flex-basis of columns to calc(${width} - ${gap}) instead of just ${width}, so did that too.

I've tested and the logic appears to work. The layout is what we want it to be, and works when you resize the viewport. Here's the code I'm testing with:

import streamlit as st
import numpy as np

# show images
# ===========

cols = st.beta_columns(3)
for col, img in zip(cols, np.zeros((3, 250, 250, 3))):
    col.image(img, use_column_width=True)

# show form
# =========

st.text_input("Search term", value="streamlit")

col1, col2 = st.beta_columns([2, 1])
col1.selectbox("1 month ago", options=["A", "B"])
col2.number_input("Limit", value=10000)

col3, col4, col5 = st.beta_columns(3)
col3.number_input("Minimum replies", value=0)
col4.number_input("Minimum retweets", value=0)
col5.number_input("Minimum hearts", value=0)

Unfortunately, there is one tiny problem. In the image gallery, one of the images is one infuriating pixel smaller than the others. This is happening because of the sizes being given to us by AutoSizer. Apparently this is a known issue.

I am going to suggest we merge this PR for now, since it fixes a whole class of sizing issues, and figure out this one off pixel problem at a later time.

@ghost ghost self-requested a review March 30, 2021 19:49
@ghost
Copy link
Author

ghost commented Mar 30, 2021

Just kidding, this breaks on variable width columns. Need to think of new solution. May need to just use grid after all...

Update: Crisis averted, a tweak to flex-basis fixed it.

@ghost ghost closed this Mar 30, 2021
@ghost ghost reopened this Mar 31, 2021
@kmcgrady
Copy link
Collaborator

kmcgrady commented Apr 1, 2021

@bh-streamlit Created PR Preview...and I tried the example from the issue, and it's still pretty far off?

image

I would understand a pixel, but this seems really off.

@ghost
Copy link
Author

ghost commented Apr 1, 2021

Huh, yeah, that definitely looks like the old behavior. I will take a look tomorrow.

@ghost
Copy link
Author

ghost commented Apr 1, 2021

@kmcgrady Seems like the same bug we've been having where CSS changes don't show up in cloud. It's a bit of a hassle, but until that's fixed, mind downloading the wheel and testing with that?

Here is what it looks like locally on my end, btw:

Copy link
Collaborator

@kmcgrady kmcgrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This responsive behavior is a bit weird, but it may be a part of the spec (essentially the column is now full width, so make it expand the width.

image

That being said. It works for me in Safari and Brave and small sizes.

@ghost ghost merged commit 3477e7b into streamlit:develop Apr 6, 2021
@ghost ghost deleted the fix-image-galleries branch April 6, 2021 01:48
tconkling added a commit that referenced this pull request Apr 6, 2021
* develop:
  Fix image galleries (#3044)
  Is this a red herring also?
  See if pylint was red herring
  Update sphinx
  Specify pylint version
  Fix pylint errors
tconkling added a commit to tconkling/streamlit that referenced this pull request Apr 6, 2021
* st_form:
  Fix image galleries (streamlit#3044)
  Is this a red herring also?
  See if pylint was red herring
  Update sphinx
  Specify pylint version
  Fix pylint errors
tconkling added a commit that referenced this pull request Apr 6, 2021
* st_form:
  Form: warn when submit button is missing (#3079)
  Fix image galleries (#3044)
  Is this a red herring also?
  See if pylint was red herring
  Update sphinx
  Specify pylint version
  Fix pylint errors
tconkling added a commit that referenced this pull request Apr 13, 2021
* develop: (165 commits)
  Add s4a message to close active modals (#2893)
  Add fail_on_warning to build options
  Docutils 0.16
  Put back Sphinx to 3.0.3
  Add import urllib to streamlit hello (#2969) (#3106)
  Update Num_Input to correct for Type Errors (#3074)
  Upgrade bokehjs to 2.2.2, and run `npx browserslist@latest --update-db` (#3090)
  remove extra star in docs (#3086)
  Remove flake8 linting tool (#3085)
  Makefile cleanup (#3083)
  Merge anchor headers feature branch into develop (#2983)
  Fix image galleries (#3044)
  Is this a red herring also?
  See if pylint was red herring
  Update sphinx
  Specify pylint version
  Fix pylint errors
  Added "allow-downloads" to the sandbox attributes (#3053)
  Small fix for `make pylint` command (#3062)
  Set genericColors properly and make theme defs more consistent (#3051)
  ...
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image Galleries broken since Version 0.78

1 participant