wx.Size

Inheritance diagram for wx.Size:



Description

A wx.Size is a useful data structure for graphics operations. It simply contains integer width and height members.

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 – the size.

Note

wxPython note: wxPython defines aliases for the x and y members named width and height since it makes much more sense for sizes.

Properties Summary

Class API

Methods

__init__(w=0, h=0)

Creates a size object.

Parameters:

  • w (int)
  • h (int)

Returns:

wx.Size


DecBy(dx, dy)

Decreases the size in x- and y- directions

Parameters:

  • dx (int)
  • dy (int)

See also

IncBy


DecTo(size)

Decrements this object so that both of its dimensions are not greater than the corresponding dimensions of the size.

Parameters:

See also

IncTo


Get()

Returns the width and height properties as a tuple.


Returns:

(width, height)


GetHeight()

Gets the height member.


Returns:

int


GetWidth()

Gets the width member.


Returns:

int


IncBy(dx, dy)

Increases the size in x- and y- directions

Parameters:

  • dx (int)
  • dy (int)

See also

DecBy


IncTo(size)

Increments this object so that both of its dimensions are not less than the corresponding dimensions of the size.

Parameters:

See also

DecTo


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 wx.DefaultSize has both of its components equal to -1).

This method is typically used before calling SetDefaults.


Returns:

bool


Scale(xscale, yscale)

Scales the dimensions of this object by the given factors.

Returns a reference to this object (so that you can concatenate other operations in the same line).

Parameters:

  • xscale (float)
  • yscale (float)

Returns:

wx.Size


Set(width, height)

Sets the width and height members.

Parameters:

  • width (int)
  • height (int)

SetDefaults(sizeDefault)

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(self.GetDefaultSize())

Parameters:

See also

IsFullySpecified


SetHeight(height)

Sets the height.

Parameters:

  • height (int)

SetWidth(width)

Sets the width.

Parameters:

  • width (int)

Properties

height
See SetHeight and GetHeight
width
See SetWidth and GetWidth
x
See SetWidth and GetWidth
y
See SetHeight and GetHeight