8000 Make it really easy to make to control the layout of output like height, width or responsiveness. · Issue #78 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content
Make it really easy to make to control the layout of output like height, width or responsiveness. #78
Closed
@MarcSkovMadsen

Description

@MarcSkovMadsen

One of the things that makes applications hard a layouts. A simple thing like achieving responsiveness can be hard.

I can see that pyscript.write does not provide me anyway to control the layout of the value. I would like to have that including options for responsiveness.

For example in the below example there should be an easy way for the matplotlib figure to just scale to 100% of its container height and width (the mpl element).

<html>
  <head>
    <!-- The link to the pyscript files are to be replaced official files when they are available at a CDN -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/MarcSkovMadsen/awesome-pyscript@master/assets/pyscript/pyscript.css" />
    <script defer src="https://cdn.jsdelivr.net/gh/MarcSkovMadsen/awesome-pyscript@master/assets/pyscript/pyscript.js"></script>
    <py-env>
    - numpy
    - matplotlib
    </py-env>
  </head>
  <body>
    <h1>Let's plot random numbers</h1>
    <div id="plot" style="height:400px;width:100%;background:whitesmoke">...loading</div>
    <!-- output="plot" id="script-id" output-mode="replace" -->
<py-script>
import matplotlib.pyplot as plt
import numpy as np

x = np.random.randn(1000)
y = np.random.randn(1000)

fig, ax = plt.subplots()
ax.scatter(x, y)
pyscript.write('plot', fig)
</py-script>
    </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogissue has been triaged but has not been earmarked for any upcoming releasetag: stylingRelated to the styling of pyscript componentstype: featureNew feature or request

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0