Popular recipes tagged "size"http://code.activestate.com/recipes/tags/size/2017-05-06T18:45:00-07:00ActiveState Code RecipesTkinter frame with different border sizes (Python) 2017-05-06T18:45:00-07:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580798-tkinter-frame-with-different-border-sizes/ <p style="color: grey"> Python recipe 580798 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/border/">border</a>, <a href="/recipes/tags/size/">size</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). </p> <p>This trick shows how to create a bordered frame with different border size in each side.</p> Human readable file/memory sizes (Python) 2012-11-05T11:59:20-08:00Tony Fluryhttp://code.activestate.com/recipes/users/4184150/http://code.activestate.com/recipes/578321-human-readable-filememory-sizes/ <p style="color: grey"> Python recipe 578321 by <a href="/recipes/users/4184150/">Tony Flury</a> (<a href="/recipes/tags/formatting/">formatting</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/size/">size</a>). Revision 5. </p> <p>In writing a application to display the file sizes of set of files, I wanted to provide a human readable size rather then just displaying a byte count (which can get rather big).</p> <p>I developed this useful short recipe that extends the format specifier mini Language to add the S presentation type - which will intelligently convert the value to be displayed into a known human readable size format - i.e. b, Kb,Mb, Gb etc. It honours the rest of the format specification language (<a href="http://docs.python.org/2/library/string.html#format-string-syntax%29" rel="nofollow">http://docs.python.org/2/library/string.html#format-string-syntax)</a></p> <p>It uses a factor of 1024 at each stage</p> A DEMO To Show How To Expand A Standard Python Terminal On The Fly... (Python) 2012-12-17T12:47:14-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578383-a-demo-to-show-how-to-expand-a-standard-python-ter/ <p style="color: grey"> Python recipe 578383 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/campimeter/">campimeter</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/size/">size</a>, <a href="/recipes/tags/terminal/">terminal</a>, <a href="/recipes/tags/window/">window</a>). </p> <p>This code shows how to open up a default Terminal running Python to tha maximum allowed on the _desktop_. I decided on writing code to do a crude emulation of a Campimeter. Anyone who has worn spectacles for a long time has had this test done at the optician's. Originally written for a Macbook Pro, OSX 10.7.5 but also tested on Debian Linux 6.0.x. READ the code for more information!!! This code WILL alter the size of the Terminal window AND changes the colours too, although it is very easy to return back to the default state it is NOT included in the code... I EXPECT professionals to know how to doo that.</p> <p>Before running Python inside the Terminal ensure the Terminal window is at the uppermost left hand corner of your desktop...</p> <p>I needed the maximised Python Terminal for something else but this was the easiest way to demonstrate ho to do it through Python...</p> <p>Written so that kids can understand what is going on...</p> <p>Enjoy finding simple solutions to often very difficult problems... ;o)</p> <p>Bazza, G0LCU...</p> Human readable file/memory sizes v2 (Python) 2012-11-11T17:28:57-08:00Tony Fluryhttp://code.activestate.com/recipes/users/4184150/http://code.activestate.com/recipes/578323-human-readable-filememory-sizes-v2/ <p style="color: grey"> Python recipe 578323 by <a href="/recipes/users/4184150/">Tony Flury</a> (<a href="/recipes/tags/formatting/">formatting</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/size/">size</a>). </p> <p>In writing a application to display the file sizes of set of files, I wanted to provide a human readable size rather then just displaying a byte count (which can get rather big).</p> <p>I developed this useful short recipe that extends the format specifier mini Language to add new presentation type s- which will intelligently convert the value to be displayed into a known human readable size format - i.e. b, Kb,Mb, Gb, B, KB etc. It honours the rest of the format specification language (<a href="http://docs.python.org/2/library/string.html#format-string-syntax%29" rel="nofollow">http://docs.python.org/2/library/string.html#format-string-syntax)</a></p> <p>It uses a factor of 1024 for IEC and common formats, and factor of 1000 for SI units.</p>