gtk.PaperSize

gtk.PaperSize — an object providing support for named paper sizes (new in PyGTK 2.10)

Synopsis

class gtk.PaperSize(gobject.GBoxed):
    gtk.PaperSize(name=None)
def copy()
def is_equal(size2)
def get_name()
def get_display_name()
def get_ppd_name()
def get_width(unit)
def get_height(unit)
def is_custom()
def set_size(width, height, unit)
def get_default_top_margin(unit)
def get_default_bottom_margin(unit)
def get_default_left_margin(unit)
def get_default_right_margin(unit)
Functions

    def gtk.paper_size_new_from_ppd(ppd_name, ppd_display_name, width, height)
def gtk.paper_size_new_cutom(name, display_name, width, height, unit)
def gtk.paper_size_get_default()

Description

Note

This class is available in PyGTK 2.10 and above.

A gtk.PaperSize handles paper sizes. It uses the standard called "PWG 5101.1-2002 PWG: Standard for Media Standardized Names" to name the paper sizes (and to get the data for the page sizes). The common standard paper sizes are named by the GTK Papaer Name Constants. In addition to standard paper sizes, gtk.PaperSize allows to construct custom paper sizes with arbitrary dimensions.

The gtk.PaperSize object stores not only the dimensions (width and height) of a paper size and its name, it also provides default print margins.

Constructor

gtk.PaperSize

    gtk.PaperSize(name=None)
name :a paper size name, or None
Returns :a new gtk.PaperSize.

Note

This constructor is available in PyGTK 2.10 and above.

Creates a new gtk.PaperSize object by parsing a PWG 5101.1-2002 PWG paper name.

If name is None, the default paper size is returned, see paper_size_get_default().

Methods

gtk.PaperSize.copy

    def copy()
Returns :a copy of other

Note

This method is available in PyGTK 2.10 and above.

The copy() method copies an existing gtk.PaperSize.

gtk.PaperSize.is_equal

    def is_equal(size2)
size2 :another gtk.PaperSize object
Returns :TRUE, if this paper size and size2 represent the same paper size

Note

This method is available in PyGTK 2.10 and above.

The is_equal() method returns the result of comparing this paper size to the gtk.PaperSize specified by size2.

gtk.PaperSize.get_name

    def get_name()
Returns :the name of the paper size

Note

This method is available in PyGTK 2.10 and above.

The get_name() method returns the name of the paper size.

gtk.PaperSize.get_display_name

    def get_display_name()
Returns :the human-readable name of the paper size.

Note

This method is available in PyGTK 2.10 and above.

The get_display_name() method returns the human-readable name of the paper size.

gtk.PaperSize.get_ppd_name

    def get_ppd_name()
Returns :the PPD name of the paper size or None

Note

This method is available in PyGTK 2.10 and above.

The get_ppd_name() method returns the PPD name of the paper size, which may be None.

gtk.PaperSize.get_width

    def get_width(unit)
unit :the unit for the return value - one of the GTK Unit Constants.
Returns :the paper width

Note

This method is available in PyGTK 2.10 and above.

The get_width() method returns the paper width of the paper size, in units of unit.

gtk.PaperSize.get_height

    def get_height(unit)
unit :the unit for the return value - one of the GTK Unit Constants.
Returns :the paper height

Note

This method is available in PyGTK 2.10 and above.

The get_height() method returns the paper height of the paper size, in units of unit.

gtk.PaperSize.is_custom

    def is_custom()
Returns :TRUE if the paper size is a custom paper size.

The is_custom() method returns TRUE if paper size is not a standard paper size.

gtk.PaperSize.set_size

    def set_size(width, height, unit)
width :the new width in units of unit
height :the new height in units of unit
unit :the unit for width and height - one of the GTK Unit Constants.

Note

This method is available in PyGTK 2.10 and above.

The set_size() method changes the dimensions of the paper size to width x height in the units specified by unit.

gtk.PaperSize.get_default_top_margin

    def get_default_top_margin(unit)
unit :the unit for the return value - one of the GTK Unit Constants.
Returns :the default top margin

Note

This method is available in PyGTK 2.10 and above.

The get_default_top_margin() method returns the default top margin for the gtk.PaperSize.

gtk.PaperSize.get_default_bottom_margin

    def get_default_bottom_margin(unit)
unit :the unit for the return value - one of the GTK Unit Constants.
Returns :the default bottom margin

Note

This method is available in PyGTK 2.10 and above.

The get_default_bottom_margin() method gets the default bottom margin for the paper size.

gtk.PaperSize.get_default_left_margin

    def get_default_left_margin(unit)
unit :the unit for the return value - one of the GTK Unit Constants.
Returns :the default left margin

Note

This method is available in PyGTK 2.10 and above.

The get_default_left_margin() method gets the default left margin for the paper size.

gtk.PaperSize.get_default_right_margin

    def get_default_right_margin(unit)
unit :the unit for the return value - one of the GTK Unit Constants.
Returns :the default right margin

Note

This method is available in PyGTK 2.10 and above.

The get_default_right_margin() method gets the default right margin for the paper size.

Functions

gtk.paper_size_new_from_ppd

    def gtk.paper_size_new_from_ppd(ppd_name, ppd_display_name, width, height)
>ppd_name :a PPD paper name
ppd_display_name :the corresponding human-readable name
width :the paper width, in points
height :the paper height in points
Returns :a new gtk.PaperSize

Note

This function is available in PyGTK 2.10 and above.

The paper_size new__from_ppd() function creates a new gtk.PaperSize object by using PPD information. If ppd_name is not a recognized PPD paper name, ppd_display_name, width and height are used to construct a custom gtk.PaperSize object.

gtk.paper_size_new_custom

    def gtk.paper_size_new_custom(name, display_name, width, height, unit)
>name :the paper name
display_name :the corresponding human-readable name
width :the paper width, in units of unit
height :the paper height in units of unit
unit :the units - one of the GTK Unit Constants.
Returns :a new gtk.PaperSize

Note

This function is available in PyGTK 2.10 and above.

The paper_size_new_custom() function creates a new gtk.PaperSize object with the given parameters.

gtk.paper_size_get_default

    def gtk.paper_size_get_default()
Returns :the name of the default paper size.

Note

This function is available in PyGTK 2.10 and above.

The paper_size_get_default() function returns the name of the default paper size, which depends on the current locale.