The media Module

The media module. This contains global convenience functions for manipulating PyGraphics objects, and imports all the supporting modules fully.

Pictures currently support the following formats: JPEG, BMP, GIF, TIFF, IM, MSP, PNG, PCX, and PPM.

Sounds support is self-contained in sound_media.py, and must be imported separately.

media.add_line(pic, x1, y1, x2, y2, col)

Draw a line of Color col from (x1, y1) to (x2, y2) on Picture pic.

media.add_oval(pic, x, y, w, h, col)

Draw an empty oval of Color col, width w, and height h on Picture pic. The upper left corner of the oval is at (x, y).

media.add_oval_filled(pic, x, y, w, h, col)

Draw a filled oval of Color col, width w, and height h on Picture pic. The upper left corner of the oval is at (x, y).

media.add_polygon(pic, point_list, col)

Draw an empty polygon of Color col with corners for every vertex in list point_list on Picture pic.

Note: point_list is a list containing vertices xy coordinates (ex. [x1,y1,x2,y2,x3,y3]) It should contain at least three coordinate pairs.

media.add_polygon_filled(pic, point_list, col)

Draw an empty polygon of Color col with corners for every vertex in list point_list on Picture pic.

Note: point_list is a list containing vertices xy coordinates (ex. [x1,y1,x2,y2,x3,y3]) It should contain at least three coordinate pairs.

media.add_rect(pic, x, y, w, h, col)

Draw an empty rectangle of Color col, width w, and height h on Picture pic. The upper left corner of the rectangle is at (x, y).

media.add_rect_filled(pic, x, y, w, h, col)

Draw a filled rectangle of Color col, width w, and height h on Picture pic. The upper left corner of the rectangle is at (x, y).

media.add_text(pic, x, y, s, col)

Draw str s in Color col on Picture pic starting at (x, y).

media.choose_color()

Prompt user to pick a color. Return a RGB Color object.

media.choose_file()

Prompt user to pick a file. Return the path to that file.

media.choose_folder()

Prompt user to pick a folder. Return the path to that folder.

media.choose_save_filename()

Prompt user to pick a directory and filename. Return the path to the new file.