A better StaticBitmap control

Hi all,

I'm building an application that will display a lot of images of various
shapes and sizes in various levels of zoom, etc. You could think of it
as a thumbnail image manager, although, that's not what it is. I'm
wondering if there is a better control to use out there besides
StaticBitmap. Reading the documentation, there is a limitation in that
it won't handle images of size greater than 64x64. Is this still the
limitation? If so, is there a public domain image widget out there that
does better, or do I have to write my own? An initial search of the
mailing list and google didn't turn anything up.

Thanks in advance,
Stephen

I guess you didn't try it :smiley: nor did you looked at the demo (Using Images section)
I don't think there is a 64x64 limit.
Anyway I did something like this and it kindda works :smiley:
It uses PIL for image processing.
Take a look :smiley:
you'll need the latest 2.5 and ofcourse PIL :smiley:

warning: do not drag anything (files) into this widget as it was designed to move the droped files to the working directory.

it has "autorun" capabilities, so, if you put the script into a directory with some images (jpg and png) and run it, it should display them as a thumbnail list, CTRL+wheel will change the size of the thumbnails, DClick will enter "Full screen" where wheel will be used for navigation.

Feel free to ask what you don't understand. :smiley:

tb.py (8.94 KB)

···

On Fri, 23 Apr 2004 08:57:29 -0400, Stephen Blake <sblake@redsiren.com> wrote:

Hi all,

I'm building an application that will display a lot of images of various
shapes and sizes in various levels of zoom, etc. You could think of it
as a thumbnail image manager, although, that's not what it is. I'm
wondering if there is a better control to use out there besides
StaticBitmap. Reading the documentation, there is a limitation in that
it won't handle images of size greater than 64x64. Is this still the
limitation? If so, is there a public domain image widget out there that
does better, or do I have to write my own? An initial search of the
mailing list and google didn't turn anything up.

Thanks in advance,
Stephen

--
Peter Damoc
Hacker Wannabe
http://www.sigmacore.net/about.html

Stephen Blake wrote:

Hi all,

I'm building an application that will display a lot of images of various
shapes and sizes in various levels of zoom, etc. You could think of it
as a thumbnail image manager, although, that's not what it is. I'm
wondering if there is a better control to use out there besides
StaticBitmap. Reading the documentation, there is a limitation in that
it won't handle images of size greater than 64x64. Is this still the
limitation?

It depends on the native control on each platform.

If so, is there a public domain image widget out there that
does better, or do I have to write my own? An initial search of the
mailing list and google didn't turn anything up.

It is *very* easy to write your own.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

> Hi all,
>
> I'm building an application that will display a lot of images of various
> shapes and sizes in various levels of zoom, etc. You could think of it
> as a thumbnail image manager, although, that's not what it is. I'm
> wondering if there is a better control to use out there besides
> StaticBitmap. Reading the documentation, there is a limitation in that
> it won't handle images of size greater than 64x64. Is this still the
> limitation? If so, is there a public domain image widget out there that
> does better, or do I have to write my own? An initial search of the
> mailing list and google didn't turn anything up.
>
> Thanks in advance,
> Stephen

I guess you didn't try it :smiley: nor did you looked at the demo (Using Images
section)

You're right. I did look in the examples section, though. :slight_smile:

I don't think there is a 64x64 limit.

Yep, you're right, I guess GTK backend supports it and maybe Windows
doesn't.

Anyway I did something like this and it kindda works :smiley:
It uses PIL for image processing.
Take a look :smiley:
you'll need the latest 2.5 and ofcourse PIL :smiley:

I have PIL and latest 2.5, but I get a bunch of

Traceback (most recent call last):
  File "tb.py", line 155, in OnGetItemImage
    self.il.Replace(idx, fileToThumb(self.tlist[item], self.tsize))
  File "tb.py", line 15, in fileToThumb
    dc.SetBackground(wx.WHITE_BRUSH)
  File "/usr/lib/python2.2/site-packages/wx/gdi.py", line 2493, in SetBackground
    return _gdi.DC_SetBackground(*args, **kwargs)
wx.core.PyAssertionError: C++ assertion "wxAssertFailure" failed in ../src/gtk/dcclient.cpp(2038): invalid window dc

And then later a bunch of:

Traceback (most recent call last):
  File "tb.py", line 154, in OnGetItemImage
    idx = self.il.Add(wx.EmptyImage(self.twidth, self.theight).ConvertToBitmap())
  File "/usr/lib/python2.2/site-packages/wx/core.py", line 2279, in EmptyImage
    val = _core.new_EmptyImage(*args, **kwargs)
wx.core.PyAssertionError: C++ assertion "!IsVirtual()" failed in ../src/generic/listctrl.cpp(350): unexpected call to IsHighlighted

Not sure what that's all about, and I haven't delved into it yet, but
the code looks good and will help me out a lot, I think. It's a good
springboard to get me going, anyway, so thank you.

Stephen

···

On Fri, 2004-04-23 at 09:29, Peter Damoc wrote:

On Fri, 23 Apr 2004 08:57:29 -0400, Stephen Blake <sblake@redsiren.com> > wrote:

well, Robin is right, it is *very* easy :smiley:
I often found myself trying to ask something on this mailing list and when I do that simple test app that should demonstrate what kind of thing I want I descover that...well... it works :smiley: so there is no need to ask anymore.

···

On Fri, 23 Apr 2004 08:58:51 -0700, Robin Dunn <robin@alldunn.com> wrote:

Stephen Blake wrote:

If so, is there a public domain image widget out there that
does better, or do I have to write my own? An initial search of the
mailing list and google didn't turn anything up.

It is *very* easy to write your own.

--
Peter Damoc
Hacker Wannabe
http://www.sigmacore.net/about.html

I'll tell you what is all about... :smiley: it's due to the linux (wxGTK) implementation of the ListCtrl in virtual mode.
If you look closer to the code you'll realise that I used a virtual list to try and prevent a long creation time, I tried to use the list in normal mode, add empty images to it and replace those in a background thread as the thumbnails get generated BUT if the directory has a lot of images it takes A LOT OF TIME to add empty images to the list, I don't know why but it takes (well it did... I haven't tried it with the new versions).
I wanted to mention that it might not work in Linux but I hoped you're lucky :wink:
Anyway, if you find a workaround for the issues... maybe the widget could be made cross-platform. :smiley:

···

On Fri, 23 Apr 2004 15:35:49 -0400, Stephen Blake <sblake@redsiren.com> wrote:

Not sure what that's all about, and I haven't delved into it yet, but
the code looks good and will help me out a lot, I think. It's a good
springboard to get me going, anyway, so thank you.

Stephen

--
Peter Damoc
Hacker Wannabe
http://www.sigmacore.net/about.html