PageSetup

class PageSetup(**properties: Any)

Superclasses: Object

Constructors:

PageSetup(**properties)
new() -> Gtk.PageSetup
new_from_file(file_name:str) -> Gtk.PageSetup
new_from_gvariant(variant:GLib.Variant) -> Gtk.PageSetup
new_from_key_file(key_file:GLib.KeyFile, group_name:str=None) -> Gtk.PageSetup

Constructors

class PageSetup
classmethod new() PageSetup

Creates a new GtkPageSetup.

classmethod new_from_file(file_name: str) PageSetup

Reads the page setup from the file file_name.

Returns a new GtkPageSetup object with the restored page setup, or None if an error occurred. See to_file.

Parameters:

file_name – the filename to read the page setup from

classmethod new_from_gvariant(variant: Variant) PageSetup

Desrialize a page setup from an a{sv} variant.

The variant must be in the format produced by to_gvariant.

Parameters:

variant – an a{sv} GVariant

classmethod new_from_key_file(key_file: KeyFile, group_name: str | None = None) PageSetup

Reads the page setup from the group group_name in the key file key_file.

Returns a new GtkPageSetup object with the restored page setup, or None if an error occurred.

Parameters:
  • key_file – the GKeyFile to retrieve the page_setup from

  • group_name – the name of the group in the key_file to read to use the default name “Page Setup”

Methods

class PageSetup
get_bottom_margin(unit: Unit) float

Gets the bottom margin in units of unit.

Parameters:

unit – the unit for the return value

get_left_margin(unit: Unit) float

Gets the left margin in units of unit.

Parameters:

unit – the unit for the return value

get_orientation() PageOrientation

Gets the page orientation of the GtkPageSetup.

get_page_height(unit: Unit) float

Returns the page height in units of unit.

Note that this function takes orientation and margins into consideration. See get_paper_height.

Parameters:

unit – the unit for the return value

get_page_width(unit: Unit) float

Returns the page width in units of unit.

Note that this function takes orientation and margins into consideration. See get_paper_width.

Parameters:

unit – the unit for the return value

get_paper_height(unit: Unit) float

Returns the paper height in units of unit.

Note that this function takes orientation, but not margins into consideration. See get_page_height.

Parameters:

unit – the unit for the return value

get_paper_size() PaperSize

Gets the paper size of the GtkPageSetup.

get_paper_width(unit: Unit) float

Returns the paper width in units of unit.

Note that this function takes orientation, but not margins into consideration. See get_page_width.

Parameters:

unit – the unit for the return value

get_right_margin(unit: Unit) float

Gets the right margin in units of unit.

Parameters:

unit – the unit for the return value

get_top_margin(unit: Unit) float

Gets the top margin in units of unit.

Parameters:

unit – the unit for the return value

load_file(file_name: str) bool

Reads the page setup from the file file_name.

See to_file.

Parameters:

file_name – the filename to read the page setup from

load_key_file(key_file: KeyFile, group_name: str | None = None) bool

Reads the page setup from the group group_name in the key file key_file.

Parameters:
  • key_file – the GKeyFile to retrieve the page_setup from

  • group_name – the name of the group in the key_file to read to use the default name “Page Setup”

set_bottom_margin(margin: float, unit: Unit) None

Sets the bottom margin of the GtkPageSetup.

Parameters:
  • margin – the new bottom margin in units of unit

  • unit – the units for margin

set_left_margin(margin: float, unit: Unit) None

Sets the left margin of the GtkPageSetup.

Parameters:
  • margin – the new left margin in units of unit

  • unit – the units for margin

set_orientation(orientation: PageOrientation) None

Sets the page orientation of the GtkPageSetup.

Parameters:

orientation – a GtkPageOrientation value

set_paper_size(size: PaperSize) None

Sets the paper size of the GtkPageSetup without changing the margins.

See set_paper_size_and_default_margins.

Parameters:

size – a GtkPaperSize

set_paper_size_and_default_margins(size: PaperSize) None

Sets the paper size of the GtkPageSetup and modifies the margins according to the new paper size.

Parameters:

size – a GtkPaperSize

set_right_margin(margin: float, unit: Unit) None

Sets the right margin of the GtkPageSetup.

Parameters:
  • margin – the new right margin in units of unit

  • unit – the units for margin

set_top_margin(margin: float, unit: Unit) None

Sets the top margin of the GtkPageSetup.

Parameters:
  • margin – the new top margin in units of unit

  • unit – the units for margin

to_file(file_name: str) bool

This function saves the information from setup to file_name.

Parameters:

file_name – the file to save to

to_gvariant() Variant

Serialize page setup to an a{sv} variant.

to_key_file(key_file: KeyFile, group_name: str | None = None) None

This function adds the page setup from setup to key_file.

Parameters:
  • key_file – the GKeyFile to save the page setup to

  • group_name – the group to add the settings to in key_file, or None to use the default name “Page Setup”