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

dynamic customer message #53

Closed
raingo opened this issue Feb 10, 2016 · 6 comments
Closed

dynamic customer message #53

raingo opened this issue Feb 10, 2016 · 6 comments

Comments

@raingo
Copy link
Contributor

raingo commented Feb 10, 2016

Currently, only a single value is used as dynamic message, i.e., the iteration index. It would be helpful to include dynamic customer message in the progress bar.

For example,

bar = ProgressBar(widgets=[Percentage(), DynamicMessage('loss'), max_value=100)
for i in range(100):
  bar.update(i, loss=random.random())

Then the bar will output something like

9% ( 78 of 100) | loss = 0.55
@wolph
Copy link
Owner

wolph commented Feb 10, 2016

That could be a useful addition indeed but I'm not entirely sure what would be the best way to implement it... one danger would be to accidently overwrite existing values although that might be something you want.

@fvisin
Copy link
Contributor

fvisin commented Mar 9, 2016

I wrote a widget to print custom text. It could probably be done in a more clever way, but I am currently using it in my code and it's working fine.

I just created a PR with it: #59

@joe-antognini
Copy link
Contributor

I wrote another widget to do this (PR #66). It modifies the update function to accept arbitrary keyword arguments (as long as the user has created a corresponding DynamicMessage widget) and add them to the progress bar like @raingo wants. @raingo's example would work with no modification.

wolph added a commit that referenced this issue May 29, 2016
wolph added a commit that referenced this issue May 29, 2016
@wolph
Copy link
Owner

wolph commented Jun 11, 2016

It's merged and released now :)

Thanks for all the help!

@wolph wolph closed this as completed Jun 11, 2016
@fvisin
Copy link
Contributor

fvisin commented Jun 12, 2016

Great! :)

@raingo
Copy link
Contributor Author

raingo commented Jun 12, 2016

Great. Thanks!

Sent from a mobile device
On Jun 12, 2016 12:52 AM, "Francesco" notifications@github.com wrote:

Great! :)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#53 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAlBZYt__XFYLrUzw4Z9CxHy5ORLneaqks5qK5CSgaJpZM4HXi7K
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants