Latest recipes by Egor Zindy http://code.activestate.com/recipes/users/2493385/new/2006-08-02T13:07:53-07:00ActiveState Code Recipesconvert a directory full of png images to a (wxPython) module (Python)
2006-08-02T06:43:56-07:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/496933-convert-a-directory-full-of-png-images-to-a-wxpyth/
<p style="color: grey">
Python
recipe 496933
by <a href="/recipes/users/2493385/">Egor Zindy</a>
(<a href="/recipes/tags/graphics/">graphics</a>).
</p>
<p>I use this utility to generate an "images.py" module which I use to provide images to my applications via wx.ImageFromStream . You can see an output in my other recipe "A foldable panel with a Windows XP look and feel". The utility is called "convert.py" and can be put in a folder together with the png images. When run, it'll generate the "images.py" file which can be moved to wherever it'll be used. The only thing I'm checking for is that "convert.py" won't overwrite an existing "images.py" file in the same directory.</p>
A foldable panel with a Windows XP look and feel (wxPython) (Python)
2006-08-02T02:55:40-07:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/496929-a-foldable-panel-with-a-windows-xp-look-and-feel-w/
<p style="color: grey">
Python
recipe 496929
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
</p>
<p>I wrote this foldable panel to keep the look of my applications consistant with Windows. The code is extremely simple and is nowhere as flexible as the foldable panel already available in wxPython. Demo available in the code.</p>
Dynamic system tray icon (wxPython) (Python)
2006-03-21T09:55:22-08:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/475155-dynamic-system-tray-icon-wxpython/
<p style="color: grey">
Python
recipe 475155
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
Revision 2.
</p>
<p>This recipe generates a dynamic icon (2 vertical, 5 segment bar graphs) in the system tray.</p>
XMLMenuLoader creates a wx.MenuBar from an XML definition (Python)
2005-06-22T14:51:08-07:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/426409-xmlmenuloader-creates-a-wxmenubar-from-an-xml-defi/
<p style="color: grey">
Python
recipe 426409
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
</p>
<p>XMLMenuLoader uses XML definitions to create a wx.MenuBar. It is based on the code in this post:</p>
<p><a href="http://mail.python.org/pipermail/python-list/2001-June/046912.html" rel="nofollow">http://mail.python.org/pipermail/python-list/2001-June/046912.html</a></p>
<p>and adds checkable menus and submenus.</p>
ColumnSorterMixin with a Virtual wx.ListCtrl (Python)
2006-08-02T13:07:53-07:00Egor Zindyhttp://code.activestate.com/recipes/users/2493385/http://code.activestate.com/recipes/426407-columnsortermixin-with-a-virtual-wxlistctrl/
<p style="color: grey">
Python
recipe 426407
by <a href="/recipes/users/2493385/">Egor Zindy</a>
.
Revision 2.
</p>
<p>This recipe shows a way of using ColumnSorterMixin with virtual lists (wx.ListCtrl defined with the wx.LC_VIRTUAL flag). The sample code pretty much follows the wx.listctrl demo (provided with wxPython). The interesting bit is the TestVirtualList class and the musicdata dictionary (altogether lines 42 to 257). Remainder is provided to run the TestVirtualList class (or others from the wxdemo) standalone.</p>
<p>The idea is to combine an itemDataMap dictionary with an index table which defines the order in which the dictionary items are displayed. The actual display is handled by the virtual list using only the OnGetItemText, OnGetItemImage and OnGetItemAttr methods.</p>
<p>First of all, the 3 methods OnGetItemText OnGetItemImage and OnGetItemAttr must be declared. Following the ListCtrl demo and in addition to the self.itemDataMap dictionary, a self.itemIndexMap table defines the items order.</p>
<p>ColumnSorterMixin uses the SortItems, GetListrCtrl and GetSortImages methods which are redefined here.
GetListCtrl now returns self (to keep the mixin happy). GetSortImages is pretty much the same as in the ListCtrl demo, only it uses the art provider (needs better looking arrows, maybe). SortItems handles the sorting. It gets the column clicked from the mixin _col variable and the sorting order (ascending or descending) from the _colSortFlag table.</p>