ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxPython-users
wxPython-users
[wxPython-users] Setting icons
by Alexander 'boesi' =?ISO-8859-1?Q?B=F6secke?= other posts by this author
Dec 4 2004 11:53AM messages near this date
RE: [wxPython-users] GTK looks ugly after upgrade of OS | [wxPython-users] Re: Setting icons
Hi

I want to set different sized icons for my app.

The following way works well:

        iconSet = wx.IconBundle()
        bmp = wx.Bitmap(r'img/logo2.bmp', wx.BITMAP_TYPE_BMP)
        bmp.SetMask(wx.Mask(bmp))
        logo = wx.IconFromBitmap(bmp)
        iconSet.AddIcon(logo)
        bmp = wx.Bitmap(r'img/logo1.bmp', wx.BITMAP_TYPE_BMP)
        bmp.SetMask(wx.Mask(bmp))
        logo = wx.IconFromBitmap(bmp)
        iconSet.AddIcon(logo)
        self.SetIcons(iconSet)

But I don't want to have a bitmap for every size, so I want to use Icons.
But when using an icon, that contains both sizes, always the bigger one
is used. If the smaller one is needed, it is scalled down and that
doesn't look very well.

        self.SetIcon(wx.Icon(r'img/logo.ico', wx.BITMAP_TYPE_ICO))

This even happens, wenn using 2 seperate icons, except that always the
last added icon is used:

        iconSet = wx.IconBundle()
        iconSet.AddIcon(wx.Icon(r'img/logo1.ico', wx.BITMAP_TYPE_ICO))
        iconSet.AddIcon(wx.Icon(r'img/logo2.ico', wx.BITMAP_TYPE_ICO))
        self.SetIcons(iconSet)

Hmm I've just realized, that the following way does the same thing as
above, i.e. uses always the last added icon:

        iconSet = wx.IconBundle()
        bmp = wx.EmptyBitmap(16,16)
        bmp.CopyFromIcon(wx.Icon(r'img/logo1.ico', wx.BITMAP_TYPE_ICO))
        iconSet.AddIcon(wx.IconFromBitmap(bmp))
        bmp = wx.EmptyBitmap(32,32)
        bmp.CopyFromIcon(wx.Icon(r'img/logo2.ico', wx.BITMAP_TYPE_ICO))
        iconSet.AddIcon(wx.IconFromBitmap(bmp))
        self.SetIcons(iconSet)

And what's really strange, after adding both icons,
self.GetIcon().GetHeight() and GetWidth() returns always 32, even if
there wasn't added an icon in this size.

The Icons/Bitmaps are all in Truecolour and have a size of 16x16 resp.
32x32. The transparent colour is black (JFI the transparency works).

And finally my question: *g*
Is there a way to use ICO-files in different sizes?

thx & cu boesi
-- 
|¯|__    ___    ___   ____  _            .:·*´¯      #1671 : icq-intern
| ´_ \  / _ \  / _ \ / __/ |_|          |¯|      #73628288 : icq-extern
| (_) )( (_) )(  __/ \__ \ |¯|        /¯¯¯¯\      boesi111 : aim
|____/__\___/__\___> _<___/_|_|________||¯| |__________i171 : reallife

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@[...].org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Thread:
Alexander 'boesi' =?ISO-8859-1?Q?B=F6secke?=
Philipp Jocham
Alexander 'boesi' =?ISO-8859-1?Q?B=F6secke?=
Robin Dunn

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved