ctrl = 1
    shift = 2
    alt = 4


bindk(key.end, scroll_bottom_right, mod.alt)
bindk(key.end, scroll_max_down, mod.ctrl)
bindk(key.end, scroll_max_right)
bindk(key.home, scroll_max_left)
bindk(key.home, scroll_max_up, mod.ctrl)
bindk(key.home, scroll_top_left, mod.alt)
bindk(key.pgdn, scroll_page_down)
bindk(key.pgdn, scroll_page_right, mod.ctrl)
bindk(key.pgup, scroll_page_left, mod.ctrl)
bindk(key.pgup, scroll_page_up)
bindk(key.num_minus, zoom_out)
bindk(key.num_plus, zoom_in)

import py.testformat as testfmt
ifaint.add_format(testfmt.load, testfmt.save, "Testformat (*.tst)", "tst")
del testfmt

import py.formatsvg as formatsvg
ifaint.add_format(formatsvg.load, formatsvg.save,
                  "Scalable Vector Graphics(*.svg)", "svg")
del formatsvg

import py.formatpdf as formatpdf
ifaint.add_format(formatpdf.load, formatpdf.save,
                  "Portable Document Format (*.pdf)", "pdf")
    else:
        active.scroll_page_down()


ifaint.scroll_traverse = _scroll_traverse

bindk(
    key.space,
    NamedFunc(
        "Select or Traverse", lambda:
        (ifaint.select_top_object()
         if ifaint.get_layer() == 1 else ifaint.scroll_traverse())))

try:
    import faint.formatsvg as formatsvg
    ifaint.add_format(formatsvg.load, formatsvg.save,
                      "Scalable Vector Graphics(*.svg)", "svg")
    del formatsvg

    import faint.formatsvgz as formatsvgz
    ifaint.add_format(formatsvgz.load, formatsvgz.save,
                      "Zipped Scalable Vector Graphics(*.svgz)", "svgz")
    del formatsvgz
except Exception as e:
    ifaint.the_error = e

import faint.formatpdf as formatpdf
ifaint.add_format(formatpdf.load, formatpdf.save,
                  "Portable Document Format (*.pdf)", "pdf")
del formatpdf

import collections
def init_dot_format():
    """Adds a format for opening GraphViz dot-files. Requires that the
    dot-application is available on the path.

    """
    ifaint.add_format(_load_dot, None, "GraphViz dot", "dot")
from ifaint import add_format, Settings


#start
def load_silly(file_path, image_props):
    frame_props = image_props.add_frame(640, 480)
    frame_props.Text((0, 0, 400, 100), file_path, Settings())


def save_silly(file_path, canvas):
    f = open(file_path, 'w')

    for object in canvas.get_objects():
        f.write(str(object) + "\n")


add_format(load_silly, save_silly, "Silly format", "silly")