2

There used to be a green 'play' button that was displayed at the bottom of a PyScript REPL element. This seems to have disappeared and the only option to execute the code is shift-enter.

Can I execute the code in the REPL by any other means, ideally via an HTML button?

I included a REPL in my code and the result did not show the execute button.

4
  • What version of PyScript are you using? Did you include the pyscript CSS as well? Commented Oct 16, 2023 at 15:54
  • I'm using the 'latest' and yes am including the CSS as well, i.e. <link rel="stylesheet" href="pyscript.net/latest/pyscript.css" /> <script defer src="pyscript.net/latest/pyscript.js"></script> Commented Oct 18, 2023 at 7:42
  • 1
    The play button typically only appears on mouse hover. You can override the :hover styles in pyscript.css to make it appear all the time. Commented Oct 18, 2023 at 15:05
  • 1
    OK, thanks. I set the default opacity in .py-repl-run-button to 1 instead of 0 and the button always shows - which is fine for what I want. It's odd that the hover style appears not to work though. Anyway, thanks for pointing out that this is a CSS problem - that was a real help. Commented Oct 19, 2023 at 10:26

1 Answer 1

1

OK, not exactly solved but Jeff Glass has explained, in the comments, that this is a CSS issue and I've solved my particular problem by setting the default opacity of the button to 1 (opaque). This makes the button show up all the time. I.e. I put this in the HTML head.

<style>
    .py-repl-run-button {
        opacity: 1;
    }
</style>

I'm still not sure why the hover style doesn't work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.