Top-rated recipes by Brent Burley http://code.activestate.com/recipes/users/98036/top/2004-01-30T16:44:42-08:00ActiveState Code RecipesInline GIF's with Tkinter (Python) 2004-01-30T16:43:32-08:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52264-inline-gifs-with-tkinter/ <p style="color: grey"> Python recipe 52264 by <a href="/recipes/users/98036/">Brent Burley</a> (<a href="/recipes/tags/ui/">ui</a>). Revision 2. </p> <p>This recipe will let you embed GIF images inside of your source code for use in Tkinter buttons, labels, etc. It's really handy for making toolbars, etc. without worrying about having the right icon files installed.</p> <p>The basic technique is to encode the GIF with base64 and store it as a string literal in the Python code to be passed to Tk PhotoImage.</p> MultiListbox Tkinter widget (Python) 2001-03-14T17:42:44-08:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52266-multilistbox-tkinter-widget/ <p style="color: grey"> Python recipe 52266 by <a href="/recipes/users/98036/">Brent Burley</a> (<a href="/recipes/tags/ui/">ui</a>). </p> <p>This is a compound widget that gangs multiple Tk Listboxes to a single scrollbar to achieve a simple multi-column scrolled listbox. Most of the Listbox API is mirrored to make it act like the normal Listbox but with multiple values per row.</p> Defining Python class methods in C (Python) 2001-04-25T10:22:15-07:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/54352-defining-python-class-methods-in-c/ <p style="color: grey"> Python recipe 54352 by <a href="/recipes/users/98036/">Brent Burley</a> (<a href="/recipes/tags/extending/">extending</a>). </p> <p>This recipe shows how to define a new Python class from a C extension module. The class methods are implemented in C, but the class can still be instantiated, extended, subclassed, etc. from Python. The same technique can also be used to extend an existing Python class with methods written in C.</p> IMAP mailwatcher program using Tkinter (Python) 2001-03-22T20:35:29-08:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52299-imap-mailwatcher-program-using-tkinter/ <p style="color: grey"> Python recipe 52299 by <a href="/recipes/users/98036/">Brent Burley</a> (<a href="/recipes/tags/network/">network</a>). </p> <p>Polls an IMAP inbox for unread messages and displays the sender and subject in a scrollable window using Tkinter.</p> <p>Reads servername, user, and password from ~/.imap file. They must be on one line, separated with spaces.</p> Method for constructing a dictionary without excessive quoting (Python) 2001-04-25T22:33:51-07:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52313-method-for-constructing-a-dictionary-without-exces/ <p style="color: grey"> Python recipe 52313 by <a href="/recipes/users/98036/">Brent Burley</a> . Revision 2. </p> <p>The syntax for constructing a dictionary can be tedious due to the amount of quoting required. This recipe presents a technique which avoids having to quote the keys.</p> htmltotext converter w/ tty support for bold/underline (Python) 2004-01-30T16:44:42-08:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52297-htmltotext-converter-w-tty-support-for-boldunderli/ <p style="color: grey"> Python recipe 52297 by <a href="/recipes/users/98036/">Brent Burley</a> (<a href="/recipes/tags/text/">text</a>). Revision 2. </p> <p>This is a complete program that reads an html doc and converts it to plain ASCII text. In the spirit of minimalism, this operates as a standard unix filter. E.g. htmltotext &lt; foo.html &gt; foo.txt</p> <p>If the output is going to a terminal, then bold and underline are displayed on the terminal. Italics in HTML are mapped to underlining on the tty. Underlining in HTML is ignored (mostly due to laziness).</p> Capturing the output and error streams from a unix shell command (Python) 2001-06-22T23:22:21-07:00Brent Burleyhttp://code.activestate.com/recipes/users/98036/http://code.activestate.com/recipes/52296-capturing-the-output-and-error-streams-from-a-unix/ <p style="color: grey"> Python recipe 52296 by <a href="/recipes/users/98036/">Brent Burley</a> (<a href="/recipes/tags/threads/">threads</a>). Revision 2. </p> <p>This recipe shows how to execute a unix shell command and capture the output and error streams in python. By contrast, os.system() sends both streams directly to the shell.</p>