intrographics

Links

The file intrographics.py will need to be saved in your project folder.

The color names in this list can be used anywhere a color is called for.

Windows

To create a window:

window = intrographics.window(width,height)

To open the window:

window.open(title?)
Shapes

To draw shapes onto a window:

shape = window.polygon((x1,y1), (x2, y2), (x3,y3), ...)
shape = window.rectangle(x,y, width,height)
shape = window.oval(x,y, width,height)

To configure a shape:

shape.fill(color) default: None
shape.border(width, color) default: 1, "black"
Properties

To check the location of a shape:

shape.left
shape.right
shape.top
shape.bottom

To check whether a shape occupies a point in the window:

if shape.occupies(x, y)

To check whether two shapes overlap:

if first.overlaps(second)
Movement

To change the location of a shape:

shape.move(dx,dy)

To remove a shape from the window:

window.remove(shape)
Timers

To start a timer:

window.on_timer(milliseconds, function)

To stop a timer:

window.off_timer(function)
Keys

To detect events:

window.on_key_press(function)

To stop detecting events:

window.off_key_press(function)
Clicks

To detect events:

window.on_left_click(function)
window.on_right_click(function)

To stop detecting events:

window.off_left_click(function)
window.off_right_click(function)
Groups

To add a shape to a group:

shape.group(name)

To remove a shape from a group:

shape.ungroup(name)

To check if a shape belongs to a group:

if shape in window.all(group)

To go through all shapes in a group:

for shape in window.all(group)
Multimedia

To load an image onto a window:

image = window.image(x,y, filename)

To write text onto a window:

text = window.text(x,y, message)

To change the appearance of text on the window:

text.format(font, size, color)

To change the message of text on the window:

text.rewrite(message)