示例#1
0
def self_test():
    """
    Perform a self test.
    """
    drink = Drink()
    
    import time
    import subprocess
    import random
    t = time.time()
    val = 1.5
    
    for _ in range(0, 100):
        drink.add_price_history(t, val)
        t += 60
        val += float(random.randint(-5, 5))/10
        if val < 0:
            val = 0 - val
        
    image = create_image(drink, 800, 600)
    
    image.save('test.png')
    subprocess.Popen(['/usr/bin/eog', 'test.png'])
示例#2
0
def self_test():
    """
    Perform a self test.
    """
    drink = Drink()

    import time
    import subprocess
    import random
    t = time.time()
    val = 1.5

    for _ in range(0, 100):
        drink.add_price_history(t, val)
        t += 60
        val += float(random.randint(-5, 5)) / 10
        if val < 0:
            val = 0 - val

    image = create_image(drink, 800, 600)

    image.save('test.png')
    subprocess.Popen(['/usr/bin/eog', 'test.png'])