Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specify bar width format-spec #623

Closed
3 tasks done
Firesphere opened this issue Oct 2, 2018 · 10 comments · Fixed by #799
Closed
3 tasks done

specify bar width format-spec #623

Firesphere opened this issue Oct 2, 2018 · 10 comments · Fixed by #799
Assignees
Labels
p4-enhancement-future 🧨 On the back burner

Comments

@Firesphere
Copy link

Firesphere commented Oct 2, 2018

  • I have visited the [source website], and in particular
    read the [known issues]
  • I have searched through the [issue tracker] for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    import tqdm, sys
    print(tqdm.__version__, sys.version, sys.platform)

I can't find it, maybe I'm stupid, but I'd like to be able to set a width for the right side data (something like this)


Messages            : 100%|█| 99/99 [00:02<00:00, 36.14it/s]
Message             : 100%|█| 3/3 [00:00<00:00, 544.17it/s]
Channels            :  95%|█▏           | 36/38 [08:54<00:22, 11.18s/it]
Relations           : 100%|█| 99/99 [00:00<00:00, 157.06it/s]

It would be nice, to make it possible to align the end of the bar (channels is the awkward one here)

@casperdcl
Copy link
Sponsor Member

Not quite sure what you mean. Can you post a minimal working example?

@casperdcl casperdcl self-assigned this Oct 3, 2018
@casperdcl casperdcl added need-feedback 📢 We need your response (question) question/docs ‽ Documentation clarification candidate labels Oct 3, 2018
@Firesphere
Copy link
Author

Firesphere commented Oct 14, 2018

Hi, sorry for the delayed reply. What I would like to achieve, is the data on the right side of the progress bar, to be aligned vertically, as ljust gives the opportunity to do it for the left side:
image
As you can see, the progress bars don't align neatly at the far end, right, due to differences in length of the set given. I'd like to be able to make it a smooth way down.

@crogre
Copy link

crogre commented Jan 11, 2019

I second this, right now my progress bars jump annoyingly if the it/s goes from say 90 it/s to 100 it/s. I really want a fixed width bar.

@casperdcl
Copy link
Sponsor Member

you can specify an ncols for a fixed bar width

@casperdcl
Copy link
Sponsor Member

you can also use set_postfix_str() with your own justified string representation of your dictionary

@crogre
Copy link

crogre commented Jan 11, 2019

using bar_format() I could get (almost) my desired behavior by supplying format values for all the variables. What I would have liked though would be to set say {bar:20}, to make the bar fixed width. Setting all the others is not easy (times and speeds are tricky).

@casperdcl casperdcl added p4-enhancement-future 🧨 On the back burner and removed need-feedback 📢 We need your response (question) question/docs ‽ Documentation clarification candidate labels Jan 11, 2019
@casperdcl
Copy link
Sponsor Member

right, got it

@Firesphere
Copy link
Author

Thanks for explaining the wished outcome clearer than I could @crogre :)

Yeah, having a fixed with for both left and right, or a fixed with for just the bar, would save a lot of jumping around of the bar.

A default width of a certain amount of characters for the right part would possibly also save a lot of jumping around.

@jeking3
Copy link

jeking3 commented Apr 17, 2019

What I would like to see is a fixed width for the bar itself:

  1. User can easily control the width of the l_bar side (description, even across multiple positioned bars).
  2. Allow the bar width to be fixed, i.e. bar_width=30
  3. Using dynamic_ncols, whatever space is left is allocated to the right side of the bar, and the content is truncated to fit on the screen.

This would prevent the bar from resizing as postfix changes.

jeking3 pushed a commit to jeking3/tqdm that referenced this issue Apr 17, 2019
- added bar_width to initializer and format_meter
- added better ncols handling for overflows on l_bar, bar, r_bar
- added tests

This fixes tqdm#623
jeking3 pushed a commit to jeking3/tqdm that referenced this issue Apr 18, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes tqdm#623
This fixes tqdm#690
This helps prevent the spillover seen in tqdm#630
jeking3 pushed a commit to jeking3/tqdm that referenced this issue Apr 18, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes tqdm#623
This fixes tqdm#690
This helps prevent the spillover seen in tqdm#630
jeking3 pushed a commit to jeking3/tqdm that referenced this issue Jun 4, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes tqdm#623
This fixes tqdm#690
This helps prevent the spillover seen in tqdm#630
jeking3 pushed a commit to jeking3/tqdm that referenced this issue Jun 4, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes tqdm#623
This fixes tqdm#690
This helps prevent the spillover seen in tqdm#630
@casperdcl casperdcl changed the title Align the right display to make sure the bar is always the same width specify bar width format-spec Aug 24, 2019
@casperdcl
Copy link
Sponsor Member

btw for now something like bar_format='{l_bar}{bar}|{r_bar:>60} might work

casperdcl added a commit that referenced this issue Aug 24, 2019
- fixes #623
- e.g. for fixed bar width of 10 and right-justified text:
  bar_format='{l_bar}{bar:10}|{bar:-10b}some text'
casperdcl added a commit that referenced this issue Aug 24, 2019
- fixes #623
- e.g. for fixed bar width of 10 and right-justified text:
  bar_format='{l_bar}{bar:10}|{bar:-10b}some text'
casperdcl pushed a commit that referenced this issue Nov 23, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes #623
This fixes #690
This helps prevent the spillover seen in #630
@casperdcl casperdcl mentioned this issue Nov 23, 2019
2 tasks
casperdcl pushed a commit that referenced this issue Dec 1, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes #623
This fixes #690
This helps prevent the spillover seen in #630
casperdcl pushed a commit that referenced this issue Dec 19, 2019
- added bar_width to initializer and format_meter that sets a fixed
  bar width that never changes (unless:)
- added better ncols handling for overflows on l_bar, bar, r_bar
  specifically, output is restricted to one line (of length ncols)
  and will be chopped to ensure that is always true
- added tests

This fixes #623
This fixes #690
This helps prevent the spillover seen in #630
casperdcl added a commit that referenced this issue Dec 19, 2019
- closes #716
- fixes #690
- related to #623
- helps avoid #630
casperdcl added a commit that referenced this issue Dec 19, 2019
- closes #850
- closes #716
- fixes #690
- related to #623
- helps avoid #630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4-enhancement-future 🧨 On the back burner
Projects
None yet
4 participants