Clutter.Units¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
pixels |
r |
||
pixels_set |
r |
||
serial |
r |
||
unit_type |
r |
||
value |
r |
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
Details¶
- class Clutter.Units¶
An opaque structure, to be used to store sizing and positioning values along with their unit.
New in version 1.0.
- classmethod from_cm(cm)¶
- Parameters:
cm (
float
) – centimeters- Returns:
- Return type:
units:
Clutter.Units
Stores a value in centimeters inside units
New in version 1.2.
- classmethod from_em(em)¶
- Parameters:
em (
float
) – em- Returns:
- Return type:
units:
Clutter.Units
Stores a value in em inside units, using the default font name as returned by
Clutter.Backend.get_font_name
()New in version 1.0.
- classmethod from_em_for_font(font_name, em)¶
- Parameters:
- Returns:
- Return type:
units:
Clutter.Units
Stores a value in em inside units using font_name
New in version 1.0.
- classmethod from_mm(mm)¶
- Parameters:
mm (
float
) – millimeters- Returns:
- Return type:
units:
Clutter.Units
Stores a value in millimiters inside units
New in version 1.0.
- classmethod from_pixels(px)¶
- Parameters:
px (
int
) – pixels- Returns:
- Return type:
units:
Clutter.Units
Stores a value in pixels inside units
New in version 1.0.
- classmethod from_pt(pt)¶
- Parameters:
pt (
float
) – typographic points- Returns:
- Return type:
units:
Clutter.Units
Stores a value in typographic points inside units
New in version 1.0.
- classmethod from_string(str)¶
- Parameters:
str (
str
) – the string to convert- Returns:
True
if the string was successfully parsed, andFalse
otherwise- units:
- Return type:
(
bool
, units:Clutter.Units
)
Parses a value and updates units with it
A
Clutter.Units
expressed in string should match:units: wsp* unit-value wsp* unit-name? wsp* unit-value: number unit-name: 'px' | 'pt' | 'mm' | 'em' | 'cm' number: digit+ | digit* sep digit+ sep: '.' | ',' digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' wsp: (#0x20 | #0x9 | #0xA | #0xB | #0xC | #0xD)+
For instance, these are valid strings:
10 px 5.1 em 24 pt 12.6 mm .3 cm
While these are not:
42 cats omg!1!ponies
If no unit is specified, pixels are assumed.
New in version 1.0.
- copy()¶
- Returns:
the newly created copy of a
Clutter.Units
structure. UseClutter.Units.free
() to free the allocated resources- Return type:
Copies self
New in version 1.0.
- free()¶
Frees the resources allocated by self
You should only call this function on a
Clutter.Units
created usingClutter.Units.copy
()New in version 1.0.
- get_unit_type()¶
- Returns:
a unit type
- Return type:
Retrieves the unit type of the value stored inside self
New in version 1.0.
- get_unit_value()¶
- Returns:
the value stored inside a
Clutter.Units
- Return type:
Retrieves the value stored inside self
New in version 1.0.
- to_pixels()¶
- Returns:
the value in pixels
- Return type:
Converts a value in
Clutter.Units
to pixelsNew in version 1.0.
- to_string()¶
- Returns:
a newly allocated string containing the encoded
Clutter.Units
value. UseGLib.free
() to free the string- Return type:
Converts self into a string
See
Clutter.Units.from_string
() for the units syntax and for examples of outputFractional values are truncated to the second decimal position for em, mm and cm, and to the first decimal position for typographic points. Pixels are integers.
New in version 1.0.