[IPython-dev] Getting the size of ipython notebook cell

Matthias Bussonnier bussonniermatthias at gmail.com
Tue Jul 8 12:46:46 EDT 2014


Le 8 juil. 2014 à 16:10, bjonen a écrit :

> I see, that's an interesting idea.  So I guess one way to get this to work
> would be to perform the truncation using javascript depending on the screen
> size information gathered from @media screen. 

Truncation is never a good idea, you will always get the truncation wrong in some cases. 

> 
> Right now, pandas returns the html code for the table, as such: 
> u'<div style="max-height:1000px;max-width:1500px;overflow:auto;">\n
> \n  \n    
> \n      	\n   
> ....
> 
> Could we simply prepend a <script> block with the necessary javascript? 

Javascript it not totally an answer either, you will/might not be able to listen for a resize event.
I would investigate pure css stuff like that :

https://css-tricks.com/examples/ResponsiveTables/responsive.php

and use bootstrap responsive utilities:

http://getbootstrap.com/css/#responsive-utilities

If you really want responsive table with dynamism and javascript I would 
suggest doing it in separate package like mpld3 does for matplotlib, or cyrile rossant handson table.

http://nbviewer.ipython.org/gist/rossant/9463955

Publishing scripts tag is always brittle and unreliable.

-- 
M


> 
> 
> 
> --
> View this message in context: http://python.6.x6.nabble.com/Getting-the-size-of-ipython-notebook-cell-tp5063264p5063400.html
> Sent from the IPython - Development mailing list archive at Nabble.com.
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev




More information about the IPython-dev mailing list