Skip to content

Commit

Permalink
Fix nonclearing output when nothing is outputed
Browse files Browse the repository at this point in the history
When the the update does not print anything the output is not cleared,
since it waits for an output to be cleared. We fix this by printing an
empty string to invoke the clearning of the output
  • Loading branch information
agoscinski committed Sep 23, 2024
1 parent 7519ac6 commit 355a8fa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/scwidgets/exercise/_widget_code_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ def _on_click_update_action(self) -> bool:
raised_error = True
raise e

# The clear_output command at the beginning of the function waits till
# something is printed. If nothing is printed, it is not cleared. We
# enforce it to be invoked by printing an empty string
print('', end='')

return not (raised_error)

def run_update(self):
Expand Down

0 comments on commit 355a8fa

Please sign in to comment.