PyTouch SDK

PyTouch is an SDK developed in python with the intended purpose of creating applications for touch surfaces. PyTouch will also prepare you for developing for many other types of touch enabled devices since it follows many of the same design practices.

Installation

Dependencies

PyTouch requires pygame in order to function. If you are on windows or linux you can just follow the instructions on pygame's website and then continue with the instructions in the PyTouch Install section.

In order to install on OSX, first you will need to install homebrew:

                ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
            

Next download pip and then run the following commands from the directory containing the file you downloaded:

                python get-pip.py
  brew install mercurial
            

Lastly you need to install a couple dependencies for pygame and pygame itself:

                brew install sdl sdl_image sdl_mixer sdl_ttf portmidi 
  sudo pip install hg+http://bitbucket.org/pygame/pygame
            

PyTouch

Now that you've installed pygame the final step is to install PyTouch! So either click here to download the zip of the project or type the following command:

                git clone https://github.com/tuftsdev/TouchTable.git
            

And in that directory type this:

                python setup.py install
            

Now in the python interpreter type import pytouch and you should receive no errors.

Your First App

Great! You are now ready to start writing PyTouch apps. Here is a simple example of an app which has a rectangle that you can click and drag around the screen.

                import pytouch
  if __name__ == "__main__":
    p = pytouch.init()
    p.Rect(50,100,100,300,drag_enabled=True)
    while 1:
      p.update()