Code Monkey home page Code Monkey logo

Comments (6)

willmcgugan avatar willmcgugan commented on May 21, 2024

That is a bug (which I'll fix), but it is exposed by a misunderstanding of the API. The second parameter to update is a boolean to force a refresh. You probably want progress.update(a_task, advance=1) or progress.advance(a_task, 1).

from rich.

willmcgugan avatar willmcgugan commented on May 21, 2024

btw progress.start() is called automatically if you use the context manager.

from rich.

willmcgugan avatar willmcgugan commented on May 21, 2024

Please try v0.8.2 in PyPi

from rich.

bphunter1972 avatar bphunter1972 commented on May 21, 2024

Thanks, Will, that seems to work.
Somewhat confused by your comment about the second parameter to update. I'm calling advance() and giving it a float--how is that not correct?
Also, wouldn't it still possible for speed to be zero if total_completed is zero on line 258?

from rich.

willmcgugan avatar willmcgugan commented on May 21, 2024

You were calling update() in your example above with two positional arguments. The second argument was actually a boolean to force a refresh.. I've since made the arguments to update() keyword only to avoid that problem. Sounds like you are using advance() the way it was intended...

It was the total_time value being zero that cause the divide by zero. That's guarded by a condition above.

Feel free to close this if it is solved.

from rich.

bphunter1972 avatar bphunter1972 commented on May 21, 2024

Oh, my mistake! That example was a manufactured snippet from my App.
Thanks! Great work!

from rich.

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.