A wx.Size is a useful data structure for graphics operations.
It simply contains integer x and y members.
Note that the width and height stored inside a wx.Size object may be negative and that wx.Size functions do not perform any check against negative values (this is used to e.g. store the special -1 value in wx.DefaultSize
instance). See also IsFullySpecified
and SetDefaults
for utility functions regarding the special -1 value.
wx.Size is used throughout wxWidgets as well as wx.Point which, although almost equivalent to wx.Size, has a different meaning: wx.Point represents a position while wx.Size represents the size.
See also
Initializes this size object with zero width and height. |
|
Decreases the size in both x and y directions. |
|
Decrements this object so that both of its dimensions are not greater than the corresponding dimensions of the size. |
|
Decrements this object to be not bigger than the given size ignoring non-specified components. |
|
Return the width and height properties as a tuple. |
|
Gets the height member. |
|
Returns an immutable representation of the |
|
Gets the width member. |
|
Increases the size in both x and y directions. |
|
Increments this object so that both of its dimensions are not less than the corresponding dimensions of the size. |
|
Returns |
|
Scales the dimensions of this object by the given factors. |
|
Sets the width and height members. |
|
Combine this size object with another one replacing the default (i.e. equal to -1) components of this object with those of the other. |
|
Sets the height. |
|
Sets the width. |
|
Possible constructors:
Size() -> None
Size(width : int, height : int) -> None
A Size is a useful data structure for graphics operations.
__init__ (self)
Initializes this size object with zero width and height.
None
__init__ (self, width : int, height : int)
Initializes this size object with the given width
and height
.
width (int)
height (int)
None
Decreases the size in both x and y directions.
See also
DecBy (self, pt : Point)
pt (wx.Point)
None
DecBy (self, size : Size)
size (wx.Size)
None
DecBy (self, dx : int, dy : int)
dx (int)
dy (int)
None
DecBy (self, d : int)
d (int)
None
Decrements this object so that both of its dimensions are not greater than the corresponding dimensions of the size.
size (wx.Size)
None
See also
Decrements this object to be not bigger than the given size ignoring non-specified components.
This is similar to DecTo
but doesn’t do anything for x or y component if the same component of size is not specified, i.e. set to wx.DefaultCoord
.
size (wx.Size)
None
Added in version 2.9.5.
Return the width and height properties as a tuple.
Gets the height member.
int
Returns an immutable representation of the wx.Size
object, based on namedtuple
.
This new object is hashable and can be used as a dictionary key,
be added to sets, etc. It can be converted back into a real wx.Size
with a simple statement like this: obj = wx.Size(imObj)
.
Gets the width member.
int
Increases the size in both x and y directions.
See also
IncBy (self, pt : Point)
pt (wx.Point)
None
IncBy (self, size : Size)
size (wx.Size)
None
IncBy (self, dx : int, dy : int)
dx (int)
dy (int)
None
IncBy (self, d : int)
d (int)
None
Increments this object so that both of its dimensions are not less than the corresponding dimensions of the size.
size (wx.Size)
None
See also
Returns True
if neither of the size object components is equal to -1, which is used as default for the size values in wxWidgets (hence the predefined wx.DefaultSize
has both of its components equal to -1).
This method is typically used before calling SetDefaults
.
bool
Scales the dimensions of this object by the given factors.
If you want to scale both dimensions by the same factor you can also use operator*=
.
xscale (float)
yscale (float)
A reference to this object (so that you can concatenate other operations in the same line).
Sets the width and height members.
width (int)
height (int)
None
Combine this size object with another one replacing the default (i.e. equal to -1) components of this object with those of the other.
It is typically used like this:
if not size.IsFullySpecified():
size.SetDefaults(GetDefaultSize())
sizeDefault (wx.Size)
None
See also
Sets the height.
height (int)
None
Sets the width.
width (int)
None
factor (int)
factor (int)