wx.lib.art.flagart and ObjectListView

I am trying to use the country flags as images in OLV but I get a black bar below each image.

http://www.thewinecellarbook.com/tempstuff/olvFlagProblem.jpg

I use the following to add it to the image list which is managed by OLV.

myOlv.AddNamedImages(flag, flags.catalog[flag].GetBitmap())

I can get rid of the bar by doing:

myOlv.AddNamedImages(flag, flags.catalog[flag].GetImage().Scale(16, 16).ConvertToBitmap())

But the flags do not look nice in that way (flag images seem mostly/all to be 16 x 11).

What is the best way to remove the black bar, i.e. make it transparent or white would probably be fine too.

Werner

Hi Werner,

This problem is actually unrelated to ObjectListView – it’s a straight ListCtrl question/issue.

The default small image list in an ObjectListView (and indeed most ListCtrls) is 16x16. When you add a bitmap of different dimensions, the difference is left blank (black).

In your case, instead of using Scale(), use Resize(). It lets you specify the background you want and where you want the original image to be placed.

Regards,
Phillip

···

2008/8/3 Werner F. Bruhin werner.bruhin@free.fr

I am trying to use the country flags as images in OLV but I get a black bar below each image.

http://www.thewinecellarbook.com/tempstuff/olvFlagProblem.jpg

I use the following to add it to the image list which is managed by OLV.

myOlv.AddNamedImages(flag, flags.catalog[flag].GetBitmap())

I can get rid of the bar by doing:

myOlv.AddNamedImages(flag, flags.catalog[flag].GetImage().Scale(16, 16).ConvertToBitmap())

But the flags do not look nice in that way (flag images seem mostly/all to be 16 x 11).

What is the best way to remove the black bar, i.e. make it transparent or white would probably be fine too.

Werner


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Phillip Piper www.bigfoot.com/~phillip_piper phillip_piper@bigfoot.com

A man’s life does not consist in the abundance of his possessions

Hi Pillip,

Phillip Piper wrote:

Hi Werner,

This problem is actually unrelated to ObjectListView -- it's a straight ListCtrl question/issue.

The default small image list in an ObjectListView (and indeed most ListCtrls) is 16x16. When you add a bitmap of different dimensions, the difference is left blank (black).

In your case, instead of using Scale(), use Resize(). It lets you specify the background you want and where you want the original image to be placed.

Yeap, doing this works great.
myOlv.AddNamedImages(flag, flags.catalog[flag].GetImage().Resize((16, 16), (0, 0)).ConvertToBitmap())

Thanks
Werner

···

Regards,
Phillip

2008/8/3 Werner F. Bruhin <werner.bruhin@free.fr <mailto:werner.bruhin@free.fr>>

    I am trying to use the country flags as images in OLV but I get a
    black bar below each image.

    http://www.thewinecellarbook.com/tempstuff/olvFlagProblem.jpg

    I use the following to add it to the image list which is managed
    by OLV.

    myOlv.AddNamedImages(flag, flags.catalog[flag].GetBitmap())

    I can get rid of the bar by doing:

    myOlv.AddNamedImages(flag,
    flags.catalog[flag].GetImage().Scale(16, 16).ConvertToBitmap())

    But the flags do not look nice in that way (flag images seem
    mostly/all to be 16 x 11).

    What is the best way to remove the black bar, i.e. make it
    transparent or white would probably be fine too.

    Werner
    _______________________________________________
    wxpython-users mailing list
    wxpython-users@lists.wxwidgets.org
    <mailto:wxpython-users@lists.wxwidgets.org>
    http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
------------------------------------------------------------------------
Phillip Piper www.bigfoot.com/~phillip_piper <Check out our sponsor - Good Politic Guy; phillip_piper@bigfoot.com <mailto:phillip_piper@bigfoot.com>
A man's life does not consist in the abundance of his possessions
------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users