M E N U

PyEvas

Last page update: 4. november 2001

These bindings are old and probably not functional any more. You can find python bindings for current evas versions here.

What is it?

PythonPython Evas is E Canvas. It can be used to work with 2D graphics: images, lines, rectangles and of course text.

Evas Python bindings can be used to work with this great library using Python programming language.

This is the first release, which I hacked over the weekend. It's subject to change.

What's needed

Python, Evas

Download here:
pyevas.tgz

Contact:
none

Screenshot:

Example which produced shot above:

from evas import *
from math import sin, cos
import time
import string

width = 600
height = 400
imgPath = "./images/"

evas = Evas(width, height)
evas.font_add_path("./fonts")

bubble = EvasImage(imgPath + 'bubble.png')
bubble.show()

image = EvasImage(imgPath + 'bg.png')
image.move(0, 0)
image.resize(width, height)
image.show()

all = [image]

image = EvasImage(imgPath + 'image2.png')
image.move(0, 200)
image.show()
#image.set_border(100,100,100,100)

bubble.raiseup()

framerate = EvasText("notepad", 20, "Framerate")
framerate.set_color(255, 0, 0, 150)
framerate.move(20, 20)
framerate.show()

line = EvasLine()
line.set_color(0, 0, 255, 150)
line.show()

frate = val = i = j = 0
while 1:
    t1 = time.time()

    evas.loop()
    i = i + 1
    if (i % 200 < 100):
        j = j + 1
    else:
        j = j - 1
    image.move(j, 200)


    t2 = time.time()

    val = val + (t2 - t1)
    r = 48
    z = ((2 + sin(val * 6 + (3.14159 * 0))) / 3) * 64;
    x = (width - 32 - r) + (cos(val * 4 + (3.14159 * 0)) * r) - (z / 2);
    y = (r + 32) + (sin(val * 6 + (3.14159 * 0)) * r) - (z / 2);
    bubble.resize(z, z);
    bubble.move(x, y);
    bubble.fill(0, 0, z, z)

    framerate.set_font("notepad", z/2)
    if (int(t1) != int(t2)):
        framerate.set_text("Framerate: " + repr(frate))
        frate = 0
    frate = frate + 1

    x1 = 100*sin(val) + 450 + 50 * sin(val)
    y1 = 300 + 50 * cos(val)
    x2 = 100*sin(val) + 450 - 50 * sin(val)
    y2 = 300 - 50 * cos(val)
    line.set_xy(x1, y1, x2, y2)