beeware/toga

ProgressBar example would benefit from some improvements

Closed this issue · 2 comments

Describe the bug

The initial issue I found is that if you enable "auto" on the main progress bar, and then click the - button while it is progressing, each update increment will begin to flicker. This led to discovering further potential improvements.

  • The "Toggle running mode" only affects the progress bar when "Toggle indeterminate mode" is checked, and does nothing otherwise. Potential solutions: combine the two, or have "running mode" disabled unless "indeterminate" is active.
  • The -/+ buttons cause issues when "auto" is running. Potential solution: Disable -/+ when auto is running.
  • The auto_progress handler is using a for loop, and if you click the "auto" button multiple times, the loop will be initiated multiple times, which results in multiple instances of the progress bar running simultaneously leading to flickering.. Potential solution: convert "auto" to an on/off toggle, and either implement it without the for loop, or add checks to avoid the possibility of activating it multiple times.

Steps to reproduce

  1. Run the progressbar example from within the Toga repo.
  2. Click on "auto".
  3. Click on "-" or "+" while "auto" mode is running to see the update increment flicker.
  4. Click on "auto" more than once while the progress bar is still running to see the whole thing flicker as it runs multiple instances of the progress bar at the same time.

Expected behavior

It should not be possible to activate multiple auto progress bars, to interact with the -/+ buttons while auto is running, or to interact with the "running" toggle if "indeterminate" is not enabled.

Potential solutions identified above.

Screenshots

No response

Environment

  • Operating System: macOS 15.5
  • Python version: 3.13
  • Software versions:
    • Toga: 0.5.2.dev139+gef79e0427.d20250705

Logs


Additional context

Potential solutions from discussion with @HalfWhitt.

I am happy to take this on, however I didn't want to jump into it without ensuring this was the desired direction.

Completely agreed that the example could be easier to use/more obvious with a little more work in the implementation. The sort of improvements you've described here (mostly variations on the theme of "disable options that conflict/shouldn't be available) all sound like good improvements to me.

These improvements have been implemented along with the other Toga examples updates I'm currently working on. Will be in a PR soon.