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

bug(python): clicking "Show Console"/"Hide Console" doesn't show/hide console and creates extra output #1054

Open
TomBinford opened this issue May 31, 2023 · 1 comment

Comments

@TomBinford
Copy link
Contributor

TomBinford commented May 31, 2023

  1. Create a Python sketch containing print('a')
  2. Run the sketch. As expected, console shows
> a
  1. Click the "Hide Console" button. Console remains visible and shows
> a
> a
  1. Click the same button, now "Show Console". Console shows
> a
> a
> a

Clicking "Run" at any point changes the output to a single line as expected.

@TomBinford
Copy link
Contributor Author

TomBinford commented Jun 1, 2023

The hiding problem comes from CreatePythonDoc at

export default function CreatePythonDoc(prog) {
It only takes one parameter for the source code, while the caller at
const srcDocFunc = () => renderLanguage.render(renderRunResult, showConsole);
passes the showConsole parameter that should be respected.
This likely comes down to us telling the Skulpt interpreter to output directly to the div with id="inner", which we aren't controlling the visibility of.
Hopefully the fix is as simple as adjusting CSS visibility in CreatePythonDoc depending on the showConsole parameter; see an example at
export default function CreateReactDoc(code, showConsole) {
return `<html> ${getReactSrcDocHead()} ${getReactSrcDocBody(code, showConsole)}</html>`;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant