A Size is a useful data structure for graphics operations.
It simply contains integer width and height members.
Note that the width and height stored inside a Size object may be negative and that Size functions do not perform any check against negative values (this is used to e.g. store the special -1 value in DefaultSize instance). See also IsFullySpecified and SetDefaults for utility functions regarding the special -1 value.
Size is used throughout wxWidgets as well as Point which, although almost equivalent to Size, has a different meaning: Point represents a position while Size represents the size.
__init__ | Initializes this size object with zero width and height. |
DecBy | Decreases the size in both x and y directions. |
DecTo | Decrements this object so that both of its dimensions are not greater than the corresponding dimensions of the size. |
Get | Return the width and height properties as a tuple. |
GetHeight | Gets the height member. |
GetWidth | Gets the width member. |
IncBy | Increases the size in both x and y directions. |
IncTo | Increments this object so that both of its dimensions are not less than the corresponding dimensions of the size. |
IsFullySpecified | 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 DefaultSize has both of its components equal to -1). |
Scale | Scales the dimensions of this object by the given factors. |
Set | Sets the width and height members. |
SetDefaults | Combine this size object with another one replacing the default (i.e. |
SetHeight | Sets the height. |
SetWidth | Sets the width. |
__getitem__ | |
__len__ | |
__nonzero__ | |
__reduce__ | |
__repr__ | |
__setitem__ | |
__str__ | |
__imul__ | |
__iadd__ | |
__isub__ | |
__idiv__ |
Height | See GetHeight and SetHeight |
Width | See GetWidth and SetWidth |
height | See GetHeight and SetHeight |
width | See GetWidth and SetWidth |
x | See GetWidth and SetWidth |
y | See GetHeight and SetHeight |
A Size is a useful data structure for graphics operations.
Possible constructors:
Size()
Size(width, height)
Overloaded Implementations:
__init__ (self)
Initializes this size object with zero width and height.
__init__ (self, width, height)
Initializes this size object with the given width and height.
Parameters: |
|
---|
Decreases the size in both x and y directions.
See also
Overloaded Implementations:
DecBy (self, pt)
Parameters: | pt (Point) – |
---|
DecBy (self, size)
Parameters: | size (Size) – |
---|
DecBy (self, dx, dy)
Parameters: |
|
---|
DecBy (self, d)
Parameters: | d (int) – |
---|
Decrements this object so that both of its dimensions are not greater than the corresponding dimensions of the size.
Parameters: | size (Size) – |
---|
See also
Return the width and height properties as a tuple.
Return type: | tuple |
---|---|
Returns: | ( width, height ) |
Gets the height member.
Return type: | int |
---|
Gets the width member.
Return type: | int |
---|
Increases the size in both x and y directions.
See also
Overloaded Implementations:
IncBy (self, pt)
Parameters: | pt (Point) – |
---|
IncBy (self, size)
Parameters: | size (Size) – |
---|
IncBy (self, dx, dy)
Parameters: |
|
---|
IncBy (self, d)
Parameters: | d (int) – |
---|
Increments this object so that both of its dimensions are not less than the corresponding dimensions of the size.
Parameters: | size (Size) – |
---|
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 DefaultSize has both of its components equal to -1).
This method is typically used before calling SetDefaults .
Return type: | 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*= .
Parameters: |
|
---|---|
Return type: | |
Returns: | A reference to this object (so that you can concatenate other operations in the same line). |
Sets the width and height members.
Parameters: |
|
---|
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())
Parameters: | sizeDefault (Size) – |
---|
See also
Sets the height.
Parameters: | height (int) – |
---|
Sets the width.
Parameters: | width (int) – |
---|
Parameters: | factor (int) – |
---|
Parameters: | factor (int) – |
---|