gtk.PageSetup
Prev | The gtk Class Reference | Next

## gtk.PageSetup

gtk.PageSetup — an object that stores page setup information (new in PyGTK 2.10)

## Synopsis

    class gtk.PageSetup(gobject.GObject):
        gtk.PageSetup()
        def copy()
        def get_orientation()
        def set_orientation(orientation)
        def get_paper_size()
        def set_paper_size(size)
        def get_top_margin(unit)
        def set_top_margin(margin, unit)
        def get_bottom_margin(unit)
        def set_bottom_margin(margin, unit)
        def get_left_margin(unit)
        def set_left_margin(margin, unit)
        def get_right_margin(unit)
        def set_right_margin(margin, unit)
        def set_paper_size_and_default_margins(size)
        def get_paper_width(unit)
        def get_paper_height(unit)
        def get_page_width(unit)
        def get_page_height(unit)

    Functions

        def gtk.print_run_page_setup_dialog(parent, page_setup, settings)

## Ancestry

    +-- gobject.GObject
      +-- gtk.PageSetup

## gtk.PageSetup Signal Prototypes

gobject.GObject Signal Prototypes

## Description

### Note

This class is available in PyGTK 2.10 and above.

A `gtk.PageSetup` object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to the `gtk.PrintOperation` when printing. The benefit of splitting this out of the `gtk.PrintSettings` is that these affect the actual layout of the page, and thus need to be set long before user prints.

The margins specified in this object are the "print margins", i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.

To obtain a `gtk.PageSetup` use the gtk.PageSetup() constructor to get the defaults, or use the `gtk.print_run_page_setup_dialog`() function to show the page setup dialog and receive the resulting page setup. An example page setup function is:

      def do_page_setup():
        if settings == None:
          settings = gtk.PrintSettings()

        page_setup = gtk.print_run_page_setup_dialog(main_window, page_setup,
                                                     settings)

## Constructor

### gtk.PageSetup

        gtk.PageSetup()

Returns : | a new `gtk.PageSetup`.

### Note

This constructor is available in PyGTK 2.10 and above.

Creates a new `gtk.PageSetup`.

## Methods

### gtk.PageSetup.copy

        def copy()

Returns : | a copy of this page setup

### Note

This method is available in PyGTK 2.10 and above.

The `copy`() method copies this `gtk.PageSetup`.

### gtk.PageSetup.get_orientation

        def get_orientation()

Returns : | the page orientation

### Note

This method is available in PyGTK 2.10 and above.

The `get_orientation`() method returns the page orientation of the `gtk.PageSetup`. The return value must be one of the GTK Page Orientation Constants.

### gtk.PageSetup.set_orientation

        def set_orientation(orientation)

`orientation` : | one of the GTK Page Orientation Constants

### Note

This method is available in PyGTK 2.10 and above.

The `set_orientation`() method sets the page orientation of the `gtk.PageSetup` to the value specified by `orientation`. The value of `orientation` must be one of the GTK Page Orientation Constants

### gtk.PageSetup.get_paper_size

        def get_paper_size()

Returns : | the paper size

### Note

This method is available in PyGTK 2.10 and above.

The `get_paper_size`() method gets the paper size of the `gtk.PageSetup`.

### gtk.PageSetup.set_paper_size

        def set_paper_size(size)

`size` : | a `gtk.PaperSize`

### Note

This method is available in PyGTK 2.10 and above.

The `set_paper_size`() method sets the paper size of the page setup without changing the margins. See the `set_paper_size_and_default_margins`() method.

### gtk.PageSetup.get_top_margin

        def get_top_margin(unit)

`unit` : | the unit for the return value - one of the GTK Unit Constants
Returns : | the top margin

### Note

This method is available in PyGTK 2.10 and above.

The `get_top_margin`() method returns the top margin in units of `unit`.

### gtk.PageSetup.set_top_margin

        def set_top_margin(margin, unit)

`margin` : | the new top margin in units of `unit`
`unit` : | the units for `margin` - one of the GTK Unit Constants

### Note

This method is available in PyGTK 2.10 and above.

The `set_top_margin`() method sets the top margin of the page setup to the value specified by `margin` in the units specified by `unit`.

### gtk.PageSetup.get_bottom_margin

        def get_bottom_margin(unit)

`unit` : | the unit for the return value
Returns : | the bottom margin

### Note

This method is available in PyGTK 2.10 and above.

The `get_bottom_margin`() method gets the bottom margin in units of `unit`.

### gtk.PageSetup.set_bottom_margin

        def set_bottom_margin(margin, unit)

`margin` : | the new bottom margin in units of `unit`
`unit` : | the units for `margin` - one of the GTK Unit Constants

### Note

This method is available in PyGTK 2.10 and above.

The `set_bottom_margin`() method sets the bottom margin of the page setup to the value specified by `margin` using the units specified by `unit`.

### gtk.PageSetup.get_left_margin

        def get_left_margin(unit)

`unit` : | the unit for the return value
Returns : | the left margin

### Note

This method is available in PyGTK 2.10 and above.

The `get_left_margin`() method gets the left margin in units of `unit`.

### gtk.PageSetup.set_left_margin

        def set_left_margin(margin, unit)

`margin` : | the new left margin in units of `unit`
`unit` : | the units for `margin` - one of the GTK Unit Constants

### Note

This method is available in PyGTK 2.10 and above.

The `set_left_margin`() method sets the left margin of the page setup to the value specified by `margin` using the units specified by `unit`.

### gtk.PageSetup.get_right_margin

        def get_right_margin(unit)

`unit` : | the unit for the return value - one of the GTK Unit Constants
Returns : | the right margin

### Note

This method is available in PyGTK 2.10 and above.

The `get_right_margin`() method gets the right margin in units of `unit`.

### gtk.PageSetup.set_right_margin

        def set_right_margin(margin, unit)

`margin` : | the new right margin in units of `unit`
`unit` : | the units for `margin` - one of the GTK Unit Constants

### Note

This method is available in PyGTK 2.10 and above.

The `set_right_margin`() method sets the right margin of the page setup to the value specified by `margin` using the units specified by `unit`.

### gtk.PageSetup.set_paper_size_and_default_margins

        def set_paper_size_and_default_margins(size)

`size` : | a `gtk.PaperSize`

### Note

This method is available in PyGTK 2.10 and above.

The `set_paper_size_and_default_margins`() method sets the paper size of the page setup to the value specified by `size` and modifies the margins according to the new paper size.

### gtk.PageSetup.get_paper_width

        def get_paper_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_paper_width`() method returns the paper width in units of `unit`.

Note that this function takes orientation, but not margins into consideration. See the `get_page_width()` method.

### gtk.PageSetup.get_paper_height

        def get_paper_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_paper_height`() method returns the paper height in units of `unit`.

Note that this function takes orientation, but not margins into consideration. See the `get_page_height()` method.

### gtk.PageSetup.get_page_width

        def get_page_width(unit)

`unit` : | the unit for the return value - one of the GTK Unit Constants
Returns : | the page width.

### Note

This method is available in PyGTK 2.10 and above.

The `get_page_width`() method returns the page width in units of `unit`.

Note that this function takes orientation and margins into consideration. See the `get_paper_width()` method.

### gtk.PageSetup.get_page_height

        def get_page_height(unit)

`unit` : | the unit for the return value - one of the GTK Unit Constants
Returns : | the page height.

### Note

This method is available in PyGTK 2.10 and above.

The `get_page_height`() method returns the page height in units of `unit`.

Note that this function takes orientation and margins into consideration. See the `get_paper_height()` method.

## Functions

### gtk.print_run_page_setup_dialog

        def gtk.print_run_page_setup_dialog(parent, page_setup, settings)

`parent` : | transient parent, or `None`
`page_setup` : | an existing `gtk.PageSetup`, or `None`
`settings` : | a `gtk.PrintSettings`
Returns : | a new `gtk.PageSetup`

Runs a page setup dialog, letting the user modify the values from page_setup. If the user cancels the dialog, the returned `gtk.PageSetup` is identical to the passed in page_setup, otherwise it contains the modifications done in the dialog.

Note that this function may use a recursive mainloop to show the page setup dialog.

Prev | Up | Next
gtk.OptionMenu | Home | gtk.Paned