Skip to content

Commit 3e993d7

Browse files
committed
Simplify the homepage example and lengthen tutorial step 2
The homepage example built its own widget list, which hid the point that one wrapped loop already gives a working bar. It is now the first tutorial example verbatim, as the index page already claimed. The demo records at 80 columns instead of 60, since the default widget set left a two-character bar at the narrower width. Tutorial step 2 iterates 1000 items instead of 100, so its recording shows the counter climbing further.
1 parent a62847a commit 3e993d7

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

‎docs/_static/demos/homepage-quickstart.svg‎

Lines changed: 5 additions & 5 deletions
Loading

‎docs/_static/demos/tutorial-step2.svg‎

Lines changed: 1 addition & 1 deletion
Loading

‎docs/examples/_registry.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def svg_path(self) -> pathlib.Path:
5858

5959
DEMOS: tuple[Demo, ...] = (
6060
Demo(
61-
'homepage/quickstart', 'A percentage and a coloured bar', term_width=60
61+
'homepage/quickstart',
62+
'A working progress bar in one line',
63+
term_width=80,
6264
),
6365
Demo('howto/colors', 'Fixed and gradient bar colors'),
6466
Demo('howto/custom-widget', 'The current job phase', term_width=60),

‎docs/examples/homepage/quickstart.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
"""Show a percentage and a bar that changes colour as work progresses."""
1+
"""Wrap an iterable to show its progress."""
22

33
import time
44

55
import progressbar
66

77

88
def main() -> None:
9-
for _ in progressbar.progressbar(
10-
range(100),
11-
widgets=[progressbar.Percentage(), ' ', progressbar.Bar()],
12-
):
13-
time.sleep(0.03)
9+
for _ in progressbar.progressbar(range(100), fast=False):
10+
time.sleep(0.01)
1411

1512

1613
if __name__ == '__main__':

‎docs/examples/tutorial/step2.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
def main() -> None:
1515
with progressbar.ProgressBar() as bar:
16-
for i in range(100):
16+
for i in range(1000):
1717
time.sleep(0.01)
1818
bar.update(i + 1)
1919

0 commit comments

Comments
 (0)