[IPython-dev] Implementing widgets

Ondřej Čertík ondrej.certik@gmail....
Sun Jun 9 16:14:10 CDT 2013


Hi Jake,

Yes. And also the same thing on the JS side --- currently I am
populating the global name space with global functions, which is not
good. Ideally there would be some nice javascript class/object and
then we'll attach the instances into the global IPython object.

Also, this is just a demo of exactly one slider to show that the user
interface can be a nice simple Python code. I actually need more GUI
elements. So I think that something like Traits UI:

http://code.enthought.com/projects/traits/docs/html/index.html

would be the way to go.

Those are all questions that the IPython developers should provide
feedback on, so that I can do something that could be merged.

Ondrej

On Sat, Jun 8, 2013 at 3:43 PM, Jacob Vanderplas
<jakevdp@cs.washington.edu> wrote:
> Very cool!
> One comment: I think that rather than passing python_var an explicit name,
> it might be better to populate a dict in the IPython namespace with the
> names of objects that need to be accessed by the javascript.  i.e., within
> the slider init function, you could have something along the lines of:
>
> ```
> import IPython
> if not hasattr(IPython, "_interactive_elements"):
>     IPython._interactive_elements = {}
>
> key = random.randint(0, 1E7)  # or use some sort of hash function
> IPython._interactive_elements[key] = self
> self._python_var = "IPython._interactive_elements[%i]" % key
> ```
>
> That would keep track of the object names in the background.
> Other than that, I like the implementation!
>    Jake
>
>
> On Sat, Jun 8, 2013 at 12:25 PM, Ondřej Čertík <ondrej.certik@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I have implemented the slider widget here:
>>
>> http://nbviewer.ipython.org/5736280
>>
>> >From the cell [2] you can see how it is used, it's trivial. I suggest
>> you run this in your local notebook, because the cell output is not
>> visible in the nbviewer. Also you need Chrome, as Firefox doesn't
>> support the HTML 5 slider and I haven't figure out how to use jquery's
>> slider yet.
>>
>> I read your roadmap, and my understanding is that the plan is to start
>> developing this in December. Unfortunately I needed something now, so
>> I wrote the above.
>>
>> I have already tested it for rotation of a 3D visualization using VTK
>> 6 in ipython notebook (offscreen rendering) and it works great.
>>
>> What is your plan and actual ideas how these widgets should be
>> implemented?
>> Is there a reason why work on this cannot start now? I'll be happy to
>> help with this
>> and send PRs.
>>
>> If I recall correctly, you wanted to implement the widgets using the
>> IPython implementation of traits?
>>
>> Ondrej
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>


More information about the IPython-dev mailing list