How would i add a wallpapper/background image to a streamlit app? (still image) - background

not sure how to add a background image to a streamlit app.
want to add a still image to the background of a streamlit app i am building, by still i mean the user being able to scroll down and have the image stay still in the background.
not sure how to do it and im learning to do coding using streamlit

Replace your-image-url-here with your image url
st.markdown("""
<style>
.stApp {
background: url("your-image-url-here");
background-size: cover;
}
</style>""", unsafe_allow_html=True)

Related

Responsive background image without media queries

I need some guidance into making a responsive background image for an admin page without using media queries. The background image needs to respond to the browser window without stretching.
Similar to this example page
I using bootstrap 3.3.6 to build this page. The admin login page is divided as a split screen.
Left hand side is login area
Right hand side is a background image with text content on top.
http://www.r1.jxt.com.au/Admin/login.aspx?ReturnURL=~%2fadmin%2fdefault.aspx
I need all the guidance I can get to going about making this happen. Thank you!
You should change your .bg-image class with following:
.bg-image {
background: url(../img/bg-image-md.jpg) no-repeat center center;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
}
Here's something to get you started: http://codepen.io/panchroma/pen/BKdgKP
.bg-image{
background-image: url(http://images.jxt.net.au/jxt-admin/img/bg-image-lg.jpg);
background-size:cover;
background-position:50% 0 ;
}
Use the background-size property with the value of either cover or contain, and position the background image as required.
More info on the background-size property

bootstrap - how to add background color for all the screen width when using containter

I need to use container (and not container-fluid) , but I still need to add background to all the remaining background( the background color differ from container to container). any idea how to do it?
thanks!
Your question is not pretty clear.
I will answer according to my understanding.
There should be only one container in the web application. Because it comes with fix width(not in %) i.e. 1170px/970px/750px.
So there should be only one to contain the website.
Now the only background out of container can be styled with the body tag.
body{
background-color: #ddd;
}

Sencha Touch 2 instantiating a component with a background image

I'm working with Sencha Touch 2 components now.
I'm facing the following issue:
I set a background image to my components using stylesheets. My whole scene is made up of several components / containers having background images. When I instantiate my scene - the image loading process is asynchronous - i.e. my scene is displayed and then later images in the scene are loaded and displayed.
I would like to know how to wait until all my images are loaded and then display my scene. In fact, I can use Ext.Img class and its load event, but this is what I don't want to do. I need to style my images (as backgrounds) using stylesheets.
Thanks a lot.
If the images are small try embedding them as base64 encoded strings. And use them like
background: transparent url(data:image/png;base64,LONG-STRING-OF-BASE64-TEXT)
in the css.
For adding background image on different components/containers define your CSS like this:-
.x-panel{
background:url(image.jpg)no-repeat center;
}
.x-scroll-container{
background:url(image.jpg)no-repeat center;
}
.x-tab.panel{
background:url(image.jpg)no-repeat center;
}
Include this CSS in your index.html in the head section :-
<link rel="stylesheet" type="text/css" href="style.css"/>
Hope this helps.

PyQt Scaling background image using styleSheet ? or any other way?

I'm trying to resize a background image on a button
btn.setStyleSheet("background-image: url(:/AddButton.png);"
"background-repeat: no-repeat;");
tried it with
background-size: 10px auto;
but pyqt seems to be missing this CSS attribute
Is there any other way of scaling the background image on the button?
I need the background image as the icon on the button will be used on top.
any suggestions?
I believe you need to use border-image. Since the border-image property provides an alternate background, it is not required to specify a background-image when border-image is specified. In the case when both of them are specified, the border-image draws over the background-image.

Placing an image from the sprite in the specific position

Let's say i have a sprite with lots of icons. I want to place one of the icons in the specific position over the div, e.g. 15px from the right side and 20px from the top.
Previously, when i had single image file i used the following code:
background: white url(./imgs/some/icon.png) no-repeat 91% 47%;
Now then the image is in the sprite i can access it using
background-position: 0 -471px;
But as i see it there is no place to add my current 91% 47%. Is there some kind of workaround?
It's possible to use CSS3 in the project if it helps.
Thanks!
Would you be able to add another <div>, give it the correct background, and absolute position it where it needs to be? I'm thinking that your background-position percentages are probably out when you use a sprite sheet.
If I understand your set of constraints correctly, you might be able to pull it off with a single div, but only if your png has a transparent background and the icon has enough "transparent space" as to not reveal any other icons.
Try:
background: white url(./imgs/some/icon.png) 91% 47% no-repeat, transparent url(./imgs/some/icon.png) 0 -471px no-repeat;