Coder Social home page Coder Social logo

cairotft's Introduction

cairotft

image

image

image

image

cairotft is a small module for Python (3.4+) used to draw interface on tft screen using the framebuffer interface.

It's first designed for tft screens, but cairotft can draw interface on any framebuffer interface; like the default /dev/fb0 on linux consoles.

Licence

cairotft is free software made available under a BSD license. See LICENSE.txt

Fonctionnalities

  • support python 3.4 (only tested on python 3.4 for now)
  • support double-buffering
  • included with widgets:
    • blick icon
    • text marquee
  • included animation transitions formulas like mootools.Fx.Transitions
  • uses asyncio event loop
  • ... (more in the future)

Documentation

See the full documentation on readthedocs: http://cairotft.readthedocs.org

Installation

from pypi

  • create a virtualenv:

    pyvenv-3.4 ~/.virtualenvs/cairotft
    source ~/.virtualenvs/cairotft/bin/activate
  • install the package:

    pip install cairotft

from sources

  • clone the repo:

    git clone https://github.com/LinkCareServices/cairotft.git
    cd cairotft
  • create a virtualenv:

    pyvenv-3.4 ~/.virtualenvs/cairotft
    source ~/.virtualenvs/cairotft/bin/activate
  • install:

    python setup.py install
  • and for development:

    python setup.py develop
  • and (eventually) development dependencies:

    pip install --upgrade -r dev-requirements.txt

Running tests

tests

install tests and developpement requirements:

pip install -r dev-requirements.txt

on the main cairotft directory run the tests:

nosetests

or with verbosity:

nosetests -v

cairotft's People

Contributors

thomaschiroux avatar

Stargazers

 avatar Rob Crowell avatar  avatar  avatar

Watchers

 avatar James Cloos avatar

Forkers

darcyg hadess

cairotft's Issues

New release?

I think that the "fps" property would be useful for my program.

It would also be nice if you added tags in the git repo for your releases, so that we know which git tag corresponds to which release (I don't do a lot of Python, and was wondering why it was complaining about the fps argument in my test application)

Doesn't work on virtual framebuffers

I eventually want to use this on a Raspberry Pi with the new "fbtft" drivers, but I'm currently trying to set up a development environment on my desktop system.

So I created a virtual framebuffer, and set it up to look like my small TFT:

# modprobe vfb vfb_enable=1
# chown `id -u`:`id -u` /dev/fb1
# fbset -fb /dev/fb1 -xres 128 -yres 64 -depth 32

To test that it worked I copied garbage to it:
cat /dev/urandom > /dev/fb1
And checked with fbgrab that it did indeed add garbage:
fbgrab -d /dev/fb1 foo.png

That worked, I can now clear the framebuffer:
cat /dev/zero > /dev/fb1
(checking the result again gives us a black screen)

Now, using this stripped down version of the example:

from cairotft import tft 
import cairocffi

class MyDisplay(tft.TftDisplay):

    def __init__(self):
        super(MyDisplay, self).__init__(interface='/dev/fb1', cairo_format=cairocffi.FORMAT_ARGB32)

    def draw_interface(self, ctx):
        self.blank_screen(ctx=ctx,
                          color=(1.0, 0.0, 0.0, 1.0),
                          blit=True)

if __name__ == '__main__':
    disp = MyDisplay()
    disp.run()

Gives me the attached output, instead of a red screen. Any ideas?

foo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.