Comments (6)
Thanks for your support!
I think I see the issue here... The widgets you're hitting this on don't actually handle the input and so it bubbles all the way up to the unhandled input function, which will move on to the next scene on Enter. This resets the form for this demo.
I'll have a think about the proper fix, but in the meantime, you can just specify your own function (which could ignore all events) by passing it to play()
as the unhandled_input
parameter.
from asciimatics.
passing an empty function to screen.play(...,unhandled_input=lambda x: None)
Did fix it, thanks.
If I subclassed Text
or RadioButtons
, and extended the process_event
method to do something with key codes [10, 13]
(and not return the event in that case), then the events would not bubble up from Widget
to Effect
to Scene
into the Screen
, correct?
from asciimatics.
Great! I'm much happier with the empty function workaround than a hidden Effect.
Swallowing those events by subclassing the widgets (as per your suggestion) would also work. I'm not sure I want to use that for the final fix as it may prevent some future feature. To be honest, I don't know what that might be right now, but it feels I'm restricting input "just in case" rather than because the widget depends on it.
In the spirit of making asciimatics do what you would naturally want, I think I'd rather that it just defaults to an empty function (for unhandled input) if any Frames are present in the Scenes to be played.
from asciimatics.
OK - I've had a go at fixing it with 2b4c9e6. That solves all the issues for me.
Please let me know if that fixes it for you too, then I'll close the issue.
from asciimatics.
That's an interesting way fix it. Yes the current master commit no longer has this issue, thanks.
from asciimatics.
Great! I prefer to get asciimatics to give sensible defaults so that the user of the API doesn't have to get involved with the complexity if they don't want to... It sometimes means I have to jump through a few hoops.
In this case, I would have has a circular dependency between the screen.py and widgets.py if I had just started looking an object types, so thought it best to expose the decision through a formal API.
from asciimatics.
Related Issues (20)
- Asciimatics doesn't print anything. HOT 3
- Custom subprocess integration HOT 2
- Rain test fails randomly HOT 10
- Load another form after initialization HOT 5
- RayCaster sample "swallows" key when commenting out RayCaster effect HOT 6
- DarkGray access on Windows/Powershell? HOT 7
- Automate user inputs HOT 4
- Leave and re-enter asciimatics mode? HOT 2
- Emojis with "hidden characters"? HOT 11
- particles HOT 4
- Mouse Events in Win11 HOT 4
- Implementing Widget's Custom Color Palettes HOT 4
- Can we donate to the project via Paypal? HOT 3
- New release? HOT 3
- Incompatible with Python 3.12 (imp module removed)
- Support multi-line text rolling in a rect HOT 3
- The effect of selecting the check box in version 1.15.0 is different from that in version 1.14.0 HOT 1
- Right side will not align if you use Unicode character. HOT 1
- Add a way to let the user provide a custom text wrapping function HOT 8
- `RadioButtons` does not consider the right pallet when item is selected without focus HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciimatics.