wxArtProvider: documentation allows GTK icon themes, but how?

I'm using Python 2.7.2 and wxPython 2.8.12.1 on Arch Linux x86_64.

Official documentation for wxArtProvider says "When running under GTK+
2, GTK+ stock item IDs (e.g. "gtk-cdrom") may be used as well.
Additionally, if wxGTK was compiled against GTK+ >= 2.4, then it is
also possible to load icons from current icon theme by specifying
their name (without extension and directory components). Icon themes
recognized by GTK+ follow the freedesktop.org Icon Themes
specification. Note that themes are not guaranteed to contain all
icons, so wxArtProvider may return wxNullBitmap or wxNullIcon. Default
theme is typically installed in /usr/share/icons/hicolor."

However, after an extensive research, I've not been able to find how
exactly I can use icons from GTK themes by specifying their name: can
somebody paste or point me to a working example or to specific
instructions?

Especially I don't get the "by specifying their name" part: specifying
it _where_?

Thank you

Instead of the name of the stock art provider resource. For example:

  bmp = wx.ArtProvider.GetBitmap('gtk-cdrom', wx.ART_MENU)

···

On 11/12/11 7:01 AM, Dario Giovannetti wrote:

I'm using Python 2.7.2 and wxPython 2.8.12.1 on Arch Linux x86_64.

Official documentation for wxArtProvider says "When running under GTK+
2, GTK+ stock item IDs (e.g. "gtk-cdrom") may be used as well.
Additionally, if wxGTK was compiled against GTK+>= 2.4, then it is
also possible to load icons from current icon theme by specifying
their name (without extension and directory components). Icon themes
recognized by GTK+ follow the freedesktop.org Icon Themes
specification. Note that themes are not guaranteed to contain all
icons, so wxArtProvider may return wxNullBitmap or wxNullIcon. Default
theme is typically installed in /usr/share/icons/hicolor."

However, after an extensive research, I've not been able to find how
exactly I can use icons from GTK themes by specifying their name: can
somebody paste or point me to a working example or to specific
instructions?

Especially I don't get the "by specifying their name" part: specifying
it _where_?

--
Robin Dunn
Software Craftsman

Thank you so much! It was so easy in the end... There's not even need
for extending wxArtProvider :slight_smile:

I had even tried that solution, but I never used wxArtProvider before
and I was stupidly setting the Bitmap for the MenuItem _after_
Appending it to the menu, that's why it wasn't working ^^'

···

On 14 Nov, 18:31, Robin Dunn <ro...@alldunn.com> wrote:

On 11/12/11 7:01 AM, Dario Giovannetti wrote:

> I'm using Python 2.7.2 and wxPython 2.8.12.1 on Arch Linux x86_64.

> Official documentation for wxArtProvider says "When running under GTK+
> 2, GTK+ stock item IDs (e.g. "gtk-cdrom") may be used as well.
> Additionally, if wxGTK was compiled against GTK+>= 2.4, then it is
> also possible to load icons from current icon theme by specifying
> their name (without extension and directory components). Icon themes
> recognized by GTK+ follow the freedesktop.org Icon Themes
> specification. Note that themes are not guaranteed to contain all
> icons, so wxArtProvider may return wxNullBitmap or wxNullIcon. Default
> theme is typically installed in /usr/share/icons/hicolor."

> However, after an extensive research, I've not been able to find how
> exactly I can use icons from GTK themes by specifying their name: can
> somebody paste or point me to a working example or to specific
> instructions?

> Especially I don't get the "by specifying their name" part: specifying
> it _where_?

Instead of the name of the stock art provider resource. For example:

    bmp = wx\.ArtProvider\.GetBitmap\(&#39;gtk\-cdrom&#39;, wx\.ART\_MENU\)

--
Robin Dunn
Software Craftsmanhttp://wxPython.org