jakevdp / ipywidgets-static

[obsolete] Static Widgets for IPython Notebooks
BSD 3-Clause "New" or "Revised" License
108 stars 24 forks source link

Compatible with Python 3. Added label with range input value #21

Closed Robaina closed 2 years ago

Robaina commented 5 years ago

Hello there, I've added some modifications to your code to make it compatible with Python 3. I've used it successfully for my own project. I don't think that this code is at all obsolete. The current ipywidgets module does not offer the functionality of ipywidgets-static, namely: only the widgets themselves are shown statically but not the plots!

I faced this problem and thought about the idea of embedding images in the notebook. I was very happy to see that this idea was already implemented in ipywidgets-static! It is very useful to e.g. share notebooks via html with colleagues without a Python installation, or even as a supplementary file for a paper. It is strange that the code has been considered obsolete... it is unfair.

Anyway. I will use your code with the modifications I made to prepare my interactive figures. I thought that the modifications I made could be useful to someone else facing the same situation I did, i.e. using this code in Python 3, hence the pull request. Also, it is my first pull request and not a Python expert! Hope everything is fine.

Thanks!

Robaina commented 5 years ago

Right, sorry about that. I uploaded a final version with more changes. The only two important changes for Python 3 are the base64 encoding of the images and the method "items" instead of "iteritems". The rest of the changes add a label to the slider displaying the current value. Changes the order of the widgets, displaying them first at the top of the figure instead of at the bottom (similar to ipywidgets). Also, added a new optional argument "description" to the widgets because the argument "name" gets overridden in the code, so the user cannot define a custom name for the widget, only the one provided as a variable name in StaticInteract. I think this is pretty much all the changes I made...

I'm linking a html with an example of ipywidgets_static with the modifications I made here. This code works very well! Certainly of great use to me.

stsievert commented 2 years ago

It looks like you've developing your own project at https://github.com/Robaina/staticInteract. Should this PR be closed?

Do you want to open a new PR with the core changes? I'm willing to review, but I'm not sure @jakevdp has time to review.

Robaina commented 2 years ago

Hi, yeah, forgot about this PR, i's been two years. I figured you guys wouldn't have the time. It's alright with me to close this PR. I continued working on my fork because I use this code quite a lot. I didn't want to let it "die". Thanks!

stsievert commented 2 years ago

I don't think it's appropriate to merge a fork with your README changes/etc. I'd close this PR if I had the permissions; can you close this PR?

If I were you, I'd submit a new PR pointing to your project. That PR will be minimal (a single line of markdown) and won't require much review.

Robaina commented 2 years ago

Sure, sorry, closing it now