peterbrittain / asciimatics

A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Apache License 2.0
3.64k stars 238 forks source link

Not working on repl.it #217

Closed extremepayne closed 5 years ago

extremepayne commented 5 years ago

Describe the bug The example program doesn't run in a repl.

To Reproduce

  1. Make a new repl
  2. Copy the example program into main.py
  3. Add asciimatics to a file called requirements.txt
  4. Press the button labeled "run"
  5. Click on the terminal window to grab input to the terminal rather than the coding area
  6. Press the q key

Expected behavior I expected the example program to run (which it did) and then exit gracefully instead of crash upon hitting q to exit.

Screenshots image

System details

Other I'm using repl because I'm on a chromebook that doesn't support linux apps.

peterbrittain commented 5 years ago

Interesting. This is hitting an issue with resetting the signal handlers back to what they were before you ran the code. I'm going to guess it has returned None and doesn't like that being set.

peterbrittain commented 5 years ago

Yeah - running in reply it looks like the SIGWINCH handler is None. I'm not sure that you there is a good solution here. Best we can do is reinstate the Python default, which is strictly speaking wrong.

peterbrittain commented 5 years ago

I can code up a workaround, but that probably means any resize handling in repl.it will stop working.

peterbrittain commented 5 years ago

I haven't been able to test on repl.it, but this change handles the relevant case.

extremepayne commented 5 years ago

Hmmm... I don't believe I can test it either, at least until the patch is included in a PyPI release, but it looks like that should help. Thanks! In the meantime, I can try this out on a real terminal 🙂