Python: is it possible to retrieve screen size

Is there a way to retrieve the screen size in python? There are several things that I would like to do in Dash that would benefit greatly if I could get this info.

I saw a similar question about react, but I was hoping there is some python example code somewhere. Thanks much in advance.

You can only access this through JavaScript (you might be able to use a clientside callback here to pass the data back to the Python backend: clientside callback outputs to a store component which outputs to a Python function) or with CSS via media queries (which you can use to re-arrange and hide/show elements on different screensizes and is by far the most performant approach)

Thank-you chriddyp!!<----20th character. (I would have just said โ€œthanksโ€)

2 Likes

Dear Chiriddyp, can you pleae elaborate more by posting a simple example to do this in a plotly app ? I saw an example but it does not work for me. I would like something that then I can use in the rest of the app as basic wsize of the window,

Thanks