Coder Social home page Coder Social logo

Comments (6)

peterbrittain avatar peterbrittain commented on August 25, 2024

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.

brycepg avatar brycepg commented on August 25, 2024

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.

peterbrittain avatar peterbrittain commented on August 25, 2024

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.

peterbrittain avatar peterbrittain commented on August 25, 2024

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.

brycepg avatar brycepg commented on August 25, 2024

That's an interesting way fix it. Yes the current master commit no longer has this issue, thanks.

from asciimatics.

peterbrittain avatar peterbrittain commented on August 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.