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

Card without image gives error, support colored bg instead of image #25

Closed
norbusan opened this issue Jan 3, 2024 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@norbusan
Copy link

norbusan commented Jan 3, 2024

The documentation says that the image parameter is optional, but if I don't pass it, I get warning messages:

2024-01-03 21:56:32.558 ComponentRequestHandler: GET /Users/preining/.pyenv/versions/3.10.13/envs/ffe-eval-dash2/lib/python3.10/site-packages/streamlit_card/frontend/build/null read error
Traceback (most recent call last):
  File "/Users/preining/.pyenv/versions/3.10.13/envs/ffe-eval-dash2/lib/python3.10/site-packages/streamlit/web/server/component_request_handler.py", line 55, in get
    with open(abspath, "rb") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/preining/.pyenv/versions/3.10.13/envs/ffe-eval-dash2/lib/python3.10/site-packages/streamlit_card/frontend/build/null'

In fact, what I would like to see is that one can just give a color for the background, and no image is needed.

Is this possible?

Thanks for providing this widget!

@gamcoh
Copy link
Owner

gamcoh commented Jan 3, 2024

The image parameter is not optional.

But it can be, we just need the implementation

@gamcoh gamcoh added the enhancement New feature or request label Jan 3, 2024
@norbusan
Copy link
Author

norbusan commented Jan 3, 2024

Hi @gamcoh
ahhh, not optional ... you might want to update the documentation: https://github.com/gamcoh/st-card/blob/main/streamlit_card/__init__.py#L37 ;-)

I think a simple (- though don't ask me for javascript code) check for whether the image parameter is null, and then not adding the url stuff in the div should work.

Although not at all a JS guy, I might look into it.

@adchalmers
Copy link

Not really a TS/JS person either, however, happy to have a look as well.

I set the image to something blank. I used:
image = "https://upload.wikimedia.org/wikipedia/en/4/48/Blank.JPG"

@ethanknights
Copy link
Contributor

Hey @norbusan CC @gamcoh - I noticed the same error yesterday when omitting a background image - I've attempted to address this part of the issue here: #27.

@gamcoh gamcoh closed this as completed Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants