************** wx.ArtProvider ************** Inheritance diagram for `wx.ArtProvider`: | .. inheritance-diagram:: wx.ArtProvider | Description =========== `wx.ArtProvider` class is used to customize the look of wxPython application. When wxPython needs to display an icon or a bitmap (e.g. in the standard file dialog), it does not use a hard-coded resource but asks `wx.ArtProvider` for it instead. This way users can plug in their own `wx.ArtProvider` class and easily replace standard art with their own version. All that is needed is to derive a class from `wx.ArtProvider`, override its `CreateBitmap <#CreateBitmap>`_ method and register the provider with `Push <#Push>`_. There's another way of taking advantage of this class: you can use it in your code and use platform native icons as provided by `GetBitmap <#GetBitmap>`_ or `GetIcon <#GetIcon>`_ Identifying Art Resources ^^^^^^^^^^^^^^^^^^^^^^^^^ Every bitmap is known to `wx.ArtProvider` under an unique ID that is used by when requesting a resource from it. The ID is represented by wx.ArtID type and can have one of these predefined values: * ``wx.ART_ADD_BOOKMARK`` * ``wx.ART_DEL_BOOKMARK`` * ``wx.ART_HELP_SIDE_PANEL`` * ``wx.ART_HELP_SETTINGS`` * ``wx.ART_HELP_BOOK`` * ``wx.ART_HELP_FOLDER`` * ``wx.ART_HELP_PAGE`` * ``wx.ART_GO_BACK`` * ``wx.ART_GO_FORWARD`` * ``wx.ART_GO_UP`` * ``wx.ART_GO_DOWN`` * ``wx.ART_GO_TO_PARENT`` * ``wx.ART_GO_HOME`` * ``wx.ART_FILE_OPEN`` * ``wx.ART_PRINT`` * ``wx.ART_HELP`` * ``wx.ART_TIP`` * ``wx.ART_REPORT_VIEW`` * ``wx.ART_LIST_VIEW`` * ``wx.ART_NEW_DIR`` * ``wx.ART_FOLDER`` * ``wx.ART_GO_DIR_UP`` * ``wx.ART_EXECUTABLE_FILE`` * ``wx.ART_NORMAL_FILE`` * ``wx.ART_TICK_MARK`` * ``wx.ART_CROSS_MARK`` * ``wx.ART_ERROR`` * ``wx.ART_QUESTION`` * ``wx.ART_WARNING`` * ``wx.ART_INFORMATION`` * ``wx.ART_MISSING_IMAGE`` Additionally, any string recognized by custom art providers registered using `Push <#Push>`_ may be used. Derived From ^^^^^^^^^^^^^ * `wx.Object `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Delete <#Delete>`_ * `GetBitmap <#GetBitmap>`_ * `GetIcon <#GetIcon>`_ * `GetSizeHint <#GetSizeHint>`_ * `Insert <#Insert>`_ * `InsertProvider <#InsertProvider>`_ * `Pop <#Pop>`_ * `PopProvider <#PopProvider>`_ * `Push <#Push>`_ * `PushProvider <#PushProvider>`_ * `RemoveProvider <#RemoveProvider>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() `wx.ArtProvider` class is used to customize the look of wxPython application. When wxPython needs to display an icon or a bitmap (e.g. in the standard file dialog), it does not use a hard-coded resource but asks `wx.ArtProvider` for it instead. This way users can plug in their own `wx.ArtProvider` class and easily replace standard art with their own version. All that is needed is to derive a class from `wx.ArtProvider`, override its `CreateBitmap <#CreateBitmap>`_ method and register the provider with `Push <#Push>`_ :: class MyArtProvider(wx.ArtProvider): def __init__(self): wx.ArtProvider.__init__(self) def CreateBitmap(self, artid, client, size): # Create your bitmap here... return bmp | **Returns:** `wx.ArtProvider `_ -------- .. method:: Delete(provider) Delete the given `provider`. **Parameters:** * `provider` (`wx.ArtProvider `_) | **Returns:** `bool` -------- .. method:: GetBitmap(id, client=wx.ART_OTHER, size=wx.DefaultSize) Query registered providers for bitmap with given ID. **Parameters:** * `id` (int): `wx.ArtID` unique identifier of the bitmap. * `client` (int): `wx.ArtClient` identifier of the client (i.e. who is asking for the bitmap). * `size` (`wx.Size `_): Size of the returned bitmap or `wx.DefaultSize` if size doesn't matter. | **Returns:** `wx.Bitmap `_ -------- .. method:: GetIcon(id, client=wx.ART_OTHER, size=wx.DefaultSize) Query the providers for icon with given id and return it. Return `wx.NullIcon` if no provider provides it. **Parameters:** * `id` (int) * `client` (int) * `size` (`wx.Size `_) | **Returns:** `wx.Icon `_ -------- .. method:: GetSizeHint(client, platform_dependent=False) Get the size hint of an icon from a specific Art Client, queries the topmost provider if `platform_dependent` is ``False`` **Parameters:** * `client` (string) * `platform_dependent` (bool) | **Returns:** `wx.Size `_ -------- .. method:: Insert(provider) Register new art provider and add it to the bottom of providers stack (i.e. it will be queried as the last one). **Parameters:** * `provider` (`wx.ArtProvider `_) | .. seealso:: `Push <#Push>`_ -------- .. method:: InsertProvider(provider) Add new provider to the bottom of providers stack. **Parameters:** * `provider` (`wx.ArtProvider `_) -------- .. method:: Pop() Remove latest added provider and delete it. | **Returns:** `bool` -------- .. method:: PopProvider() Remove latest added provider and delete it. | **Returns:** `bool` -------- .. method:: Push(provider) Register new art provider and add it to the top of providers stack (i.e. it will be queried as the first provider). **Parameters:** * `provider` (`wx.ArtProvider `_) .. seealso:: `Insert <#Insert>`_ -------- .. method:: PushProvider(provider) Add new provider to the top of providers stack. **Parameters:** * `provider` (`wx.ArtProvider `_) -------- .. method:: RemoveProvider(provider) Remove provider. The provider must have been added previously! The provider is **not** deleted. **Parameters:** * `provider` (`wx.ArtProvider `_) | **Returns:** `bool`