[wxPython-users] Hello

Al Niessner Al.Niessner at gmx.net
Tue Oct 2 16:23:29 PDT 2007


Well I got it working finally.

for pic in pics:
    input = StringIO.StringIO(pic.getThumb())
    index = self._thumbList.Add (wx.BitmapFromImage (self._pilToImg
(Image.open (input))))
    self.Thumbs.InsertImageItem (index, index)

where
self.Thumbs = wx.ListCtrl(self.window_2_pane_1, -1, style=wx.LC_ICON|
wx.LC_NO_HEADER|wx.SUNKEN_BORDER)
self._thumbList = wx.ImageList(120, 120)
self.Thumbs.SetImageList (self._thumbList, wx.IMAGE_LIST_NORMAL)

It was the creation of Thumbs that I simply had to get right. After I
did, it all worked well.

Some of the thumbs are 120x90 or 120x90, but I use
thumb = Image.open (filename)
thumb.thumbnail ((120,120), Image.BICUBIC)

I am not sure why the thumbs come out different sizes, but it may be a
transparent part or something.

Anyway, thanks for all your help Robin and I am hoping that the history
of this will help others in the future.

On Tue, 2007-10-02 at 12:41 -0700, Robin Dunn wrote:
> Al Niessner wrote:
> 
> > 
> > Is ImageList really that sensitive to the constructed size image? In my
> > real application I have icons that are 120x90 as well as 90x120 so I
> > went with 120x120 just to cover the full range.
> 
> Yes all the bitmaps are supposed to be the same size.  To do what you 
> want you'll need to dynamically create a new bitmap that is 120x120 and 
> draw the real bitmap inside of it.
> 
> 
-- 
Al Niessner

I have never found the companion that was so companionable as solitude.
- From Walden by Henry David Thoreau

The universe is indifferent, and life is brutal; however, it is man's
choice of behavior that makes them malevolent rather than benevolent.

Some will fall in love with life and drink it from a fountain
That is pouring like an avalanche coming down the mountain.
- From the song Pepper by the Butthole Surfers






More information about the wxpython-users mailing list