GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing docs.wxpython.org — wx.BitmapBundle — wxPython 4.3.2 Docs
|
Default constructor constructs an empty bundle. |
|
Clear the existing bundle contents. |
|
Create a bundle from a single bitmap. |
|
Create a bundle from the given collection of bitmaps. |
|
Create a bundle from bitmaps stored as files. |
|
Create a bundle from an icon bundle. |
|
Create a bundle from a single image. |
|
Create a bundle from a custom bitmap bundle implementation. |
|
Create a bundle from the bitmaps in the application resources. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Create a bundle from the |
|
Create a bundle from the |
|
Get bitmap of the specified size, creating a new bitmap from the closest available size by rescaling it if necessary. |
|
Get bitmap of the size appropriate for the |
|
Get the size of the bitmap represented by this bundle in default resolution or, equivalently, at 100% scaling. |
|
Get icon of the specified size. |
|
Get icon of the size appropriate for the |
|
Get the size that would be best to use for this bundle at the given |
|
Get the size that would be best to use for this bundle at the |
|
Get the size that would be best to use for this bundle at the |
|
Check if bitmap bundle is non-empty. |
|
Check if the two bundles refer to the same object. |
|
Return a bundle providing disabled (“greyed out”) versions of the bitmaps in this bundle. |
Properties Summary¶See |
Class API¶Possible constructors:
BitmapBundle() -> None BitmapBundle(bitmap) -> None BitmapBundle(icon) -> None BitmapBundle(image) -> None BitmapBundle(other) -> None
Contains representations of the same bitmap in different resolutions.
__init__ (self)
Default constructor constructs an empty bundle.
An empty bundle can’t be used for anything, but can be assigned something else later.
None
__init__ (self, bitmap)
Conversion constructor from a single bitmap.
This constructor does the same thing as FromBitmap and only exists for interoperability with the existing code using wx.Bitmap.
bitmap (wx.Bitmap)
None
__init__ (self, icon)
Conversion constructor from a single icon.
This constructor does the same thing as FromBitmap and only exists for interoperability with the existing code using wx.Icon.
icon (wx.Icon)
None
__init__ (self, image)
Conversion constructor from a single image.
Similarly to the constructor from wx.Bitmap, this constructor only exists for interoperability with the existing code using wx.Image and can be replaced with more readable FromImage in the new code.
image (wx.Image)
None
__init__ (self, other)
Copy constructor creates a copy of another bundle.
other (wx.BitmapBundle)
None
Clear the existing bundle contents.
After calling this function IsOk returns False.
This is the same as assigning a default-constructed bitmap bundle to this object but slightly more explicit.
None
Added in version 4.1/wxWidgets-3.1.7.
Create a bundle from a single bitmap.
This is only useful for compatibility with the existing code using wx.Bitmap.
If bitmap is invalid, empty bundle is returned.
bitmap (wx.Bitmap)
FromBitmaps (bitmaps)
Create a bundle from the given collection of bitmaps.
If the bitmaps vector is empty, an invalid, empty bundle is returned, otherwise initialize the bundle with all the bitmaps in this vector which must be themselves valid.
bitmaps (Vector)
FromBitmaps (bitmap1, bitmap2)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
FromFiles (path, filename, extension=”png”)
Create a bundle from bitmaps stored as files.
This function search in path for files using filename as prefix and potentially a suffix with scale, e.g. “_2x” or “@2x”.
Additionally, since wxWidgets 3.3.2, it also looks for the file in the given name in the “2.0x” subdirectory (if it exists).
path (string) – Path of the directory containing the files
filename (string) – Bitmap’s filename without any scale suffix
extension (string) – File extension, without leading dot ( png by default)
FromFiles (fullpathname)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
fullpathname (string)
Create a bundle from an icon bundle.
If iconBundle is invalid or empty, empty bundle is returned.
iconBundle (wx.IconBundle)
Added in version 4.1/wxWidgets-3.1.7.
Create a bundle from a single image.
This is only useful for compatibility with the existing code using wx.Image.
If image is invalid, empty bundle is returned.
image (wx.Image)
Create a bundle from a custom bitmap bundle implementation.
This function can be used to create bundles implementing custom logic for creating the bitmaps, e.g. creating them on the fly rather than using predefined bitmaps.
See wx.BitmapBundleImpl.
impl (wx.BitmapBundleImpl) – A valid, i.e. non-null, pointer. This function takes ownership of it, so the caller must not call DecRef() on it.
Create a bundle from the bitmaps in the application resources.
This function can only be used on the platforms supporting storing bitmaps in resources, and currently only works under MSW and MacOS and returns an empty bundle on the other platforms.
Under MSW, for this function to create a valid bundle, you must have RCDATA resource with the given name in your application resource file (with the extension name as prefix and suffix with the scale, e.g. “_2x” or “_1_5x” (for 150% DPI) will be also loaded as part of the bundle.
name (string)
See also
FromSVG (data, sizeDef)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
data (int)
sizeDef (wx.Size)
FromSVG (data, len, sizeDef)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
data (wx.Byte)
len (int)
sizeDef (wx.Size)
FromSVG (stream, sizeDef)
Create a bundle from the SVG image read from the given stream.
This function reads the SVG data from the given stream and calls FromSVG with it. As it is just a wrapper for FromSVG , please see that function documentation for more information about SVG support.
stream (wx.InputStream) – The input stream to read SVG data from.
sizeDef (wx.Size) – The default size to return from GetDefaultSize for this bundle. If an empty wx.Size or DefaultSize is provided, the size of the SVG will be the default size.
Added in version 4.3/wxWidgets-3.3.4: This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Create a bundle from the SVG image loaded from the given file.
This function loads the SVG data from the given path and calls FromSVG with it. If the filename has a .svgz extension, then it will first be decompressed before converting it into a bundle (new since wxWidgets 3.3.4). As this function is just a wrapper for FromSVG , please see that function documentation for more information about SVG support.
path (string) – Path to the SVG file. Notice that it should be a local file, not a URL.
sizeDef (wx.Size) – The default size to return from GetDefaultSize for this bundle. If an empty wx.Size or DefaultSize is provided, the size of the SVG will be the default size.
Create a bundle from the SVG image loaded from an application resource.
Available only on the platforms supporting images in resources, i.e., MSW and MacOS.
name (string) – On MSW, it must be a resource with RT_RCDATA type. On MacOS, it must be a file with an extension “svg” placed in the “Resources” subdirectory of the application bundle.
sizeDef (wx.Size) – The default size to return from GetDefaultSize for this bundle. If an empty wx.Size or DefaultSize is provided, the size of the SVG will be the default size.
See also
Get bitmap of the specified size, creating a new bitmap from the closest available size by rescaling it if necessary.
This function is mostly used by wxWidgets itself and not the application. As all bitmaps created by it dynamically are currently cached, avoid calling it for many different sizes if you do use it, as this will create many bitmaps that will never be deleted and will consume resources until the application termination.
Get bitmap of the size appropriate for the DPI scaling used by the given window.
This helper function simply combines GetPreferredBitmapSizeFor and GetBitmap , i.e. it returns a (normally unscaled) bitmap from the bundle of the closest size to the size that should be used at the DPI scaling of the provided window.
Get the size of the bitmap represented by this bundle in default resolution or, equivalently, at 100% scaling.
When creating the bundle from a number of bitmaps, this will be just the size of the smallest bitmap in it.
Note that this function is mostly used by wxWidgets itself and not the application.
Get icon of the specified size.
This is just a convenient wrapper for GetBitmap and simply converts the returned bitmap to wx.Icon.
Get icon of the size appropriate for the DPI scaling used by the given window.
This is similar to GetBitmapFor , but returns a wx.Icon, as GetIcon does.
Get the size that would be best to use for this bundle at the given DPI scaling factor.
For bundles containing some number of the fixed-size bitmaps, this function returns the size of an existing bitmap closest to the ideal size at the given scale, i.e. GetDefaultSize multiplied by scale.
Passing a size returned by this function to GetBitmap ensures that bitmap doesn’t need to be rescaled, which typically significantly lowers its quality.
scale (float)
Get the size that would be best to use for this bundle at the DPI scaling factor used by the given window.
This is just a convenient wrapper for GetPreferredBitmapSizeAtScale calling that function with the result of wx.Window.GetDPIScaleFactor .
Get the size that would be best to use for this bundle at the DPI scaling factor used by the given window in logical size.
This is just call GetPreferredBitmapSizeAtScale with the result of wx.Window.GetDPIScaleFactor and convert returned value with wx.Window.FromPhys .
Check if bitmap bundle is non-empty.
Return True if the bundle contains any bitmaps or False if it is empty.
bool
Check if the two bundles refer to the same object.
Bundles are considered to be same only if they actually use the same underlying object, i.e. are copies of each other. If the two bundles were independently constructed, they’re not considered to be the same, even if they were created from the same bitmap.
other (wx.BitmapBundle)
bool
Return a bundle providing disabled (“greyed out”) versions of the bitmaps in this bundle.
The disabled bitmaps are generated on demand from the bitmaps of this bundle, so all the scales it provides, including SVG images rendered at arbitrary sizes, are preserved.
Returns an empty bundle if this bundle is empty.
Added in version 4.3/wxWidgets-3.3.4.
See GetDefaultSize