[[tutorials:legacy:python_kivy|{{ :kivy-icon-60.png }}]]

This binding has been deprecated - please see the most recent [[:release_notes| release notes]] for more information.

====== Getting Started I (Hello World) ====== ===== Introduction ===== In this tutorial you will prepare your development environment for use with the Python bindings for Gestureworks Core. While no code will be written in this tutorial, the steps performed here will prepare your environment for subsequent Gestureworks Core Python tutorials. For this tutorial you will need the [[http://gestureworks.com/|Gestureworks Core]] multitouch framework; a [[http://files.gestureworks.com/downloads/Core/Trial/GestureworksCoreTrialSetup.exe|free trial]] is available. Download the code for all of the Python & Kivy multitouch tutorials here: [[http://files.gestureworks.com/tutorials/tutorials_python_kivy.zip|tutorials_python_kivy.zip]] ==== Gestureworks Core "Bindings" ==== The various bindings included with Gestureworks Core allow a developer to create multitouch applications using their preferred language and framework, and are essentially mini-APIs providing an interface to the functions exported by the native Gestureworks Core library (GestureWorksCore.dll). Source code for each of the bindings is included so that you may extend or modify them as you like, as well as providing a blueprint for creating bindings for other languages or frameworks. ==== Python and Kivy ==== {{:tutorials:legacy:python_kivy:python-logo.png?nolink|Python-logo.png}} The Python bindings for Gestureworks Core can be used by any Python project. The source code for the Python bindings is provided for portability and extensibility, but can be used quite effectively as-is in most situations. {{:tutorials:legacy:python_kivy:kivy-icon-60.png?nolink|Kivy-icon-60.png}} Kivy already has built in multitouch support so why would we integrate it with Gestureworks? Kivy’s gesture recognition is great for basic prototyping or getting a feel for what it’s like to develop using multitouch. However, its true power lies in the simplicity of it’s rendering capabilities. It makes it easy to show the power and versatility of Gestureworks without getting bogged down in rendering graphics and drawing shapes. Using Gestureworks allows us to utilize a much broader set of gestures. Leveraging GML, we can create a much more flexible and customizable user experience. You don’t need to be a programmer to create and modify custom gestures for you needs. Finally, by separating gesture processing and rendering, debugging, load balancing, and optimization all become much more simple tasks. ---- ===== Requirements ===== Estimated time to completion: **15 minutes** * GestureWorks Core license * Microsoft Windows 7 or 8 * Eclipse 4.2 or later * PyDev plugin for Eclipse * Kivy 1.5.1 or later * Python 2.7 (included in Kivy installation) * Multitouch display device ---- ===== Process Overview ===== - [[tutorials:legacy:python_kivy:getting_started_1_hello_world#download_and_install_software_prerequisites|Download and install software prerequisites]] - [[tutorials:legacy:python_kivy:getting_started_1_hello_world#download_and_install_gestureworks_core_package|Download and install GestureWorks Core package]] - [[tutorials:legacy:python_kivy:getting_started_1_hello_world#configure_eclipse_for_python|Configure Eclipse for Python]] - [[tutorials:legacy:python_kivy:getting_started_1_hello_world#configure_eclipse_for_kivy|Configure Eclipse for Kivy]] - [[tutorials:legacy:python_kivy:getting_started_1_hello_world#create_a_new_kivy_project_in_eclipse|Create a new Kivy Project in Eclipse]] - [[tutorials:legacy:python_kivy:getting_started_1_hello_world#add_gwc_python_module_to_project|Add gwc_python module to project]] ---- ===== Process Detail ===== ==== 1. Download and install software prerequisites ==== Each of the following software packages must be downloaded and installed prior to continuing with the tutorial. * Eclipse: [[http://eclipse.org/downloads/|Downloads at Eclipse.org]] * Kivy "portable package" for Windows: [[http://kivy.org/#download|Kivy downloads]] ==== 2. Download and install Gestureworks Core package ==== The Gestureworks Core installer package -- GestureWorksCoreSetup.exe -- contains the main GestureWorksCore.dll files (the "native" DLLs), various bindings (C++ .NET, Python, etc.), and supporting documentation. Gestureworks Core must be licensed prior to use in any software project. * Download the Gestureworks Core Trial package from [[http://files.gestureworks.com/downloads/Core/Trial/GestureworksCoreTrialSetup.exe|here]]. * Double-click the downloaded installer package GestureWorksCoreSetup.exe to install Gestureworks Core. Gestureworks Core consists of the Gestureworks Core DLLs as well as various tutorials, bindings, and documentation. **GestureWorksCore*.dlls** \GestureWorksCore\GestureWorksCore32.dll \GestureWorksCore\GestureWorksCore64.dll **Python bindings** \GestureWorksCore\bindings\python\gwc_python **Python tutorials** \GestureWorksCore\bindings\python\kivy\tutorials **Assets for the tutorials** \GestureWorksCore\bindings\python\kivy\assets ==== 3. Configure Eclipse for Python ==== You will need to install the [[http://pydev.org/|PyDev]] Plugin. In Eclipse, select Help → Install New Software {{:tutorials:legacy:python_kivy:python_1.1.png?nolink|Python 1.1.png}} In the //Work With// field, enter http://pydev.org/updates, check the PyDev package and follow the rest of the instructions. Now that PyDev is installed, we have to configure a Python interpreter to work with Kivy. ==== 4. Configure Eclipse for Kivy ==== Open the Preferences menu by selecting //Window → Preferences//. Expand the PyDev submenu and select //Interpreter - Python//. Create a new interpreter and name it something like "Python2.7 - Kivy", where the path points to the Python interpreter that came with Kivy. You will also need to add the kivy package folder to the Library. {{:tutorials:legacy:python_kivy:python_1.2.png?nolink|Python 1.2.png}} Under the Environment tab, add the following variable mappings: GST_PLUGIN_PATH = C:\Kivy-1.5.0\gstreamer\lib\gstreamer-0.10 GST_REGISTRY = C:\Kivy-1.5.0\gstreamer\registry.bin PATH = C:\Kivy-1.5.0;C:\Kivy-1.5.0\Python;C:\Kivy-1.5.0\gstreamer\bin;C:\Kivy-1.5.0\MinGW\bin;%PATH% ==== 5. Create A New Kivy Project In Eclipse ==== Kivy provides an easy-to-use framework for developing interactive graphics-based applications using Python. It supplies easy bitmap display and manipulation using the “Scatter” object as well as easily defined timer events that are perfect for use with Gestureworks. First, create a new Kivy project in Eclipse - Click //File → New → PyDev Project// - Name the Project "GestureworksTutorial1" - (optional) Set the project directory to your desired location - Make sure that Grammar Version is set to 2.7 - Make sure that Interpreter is set to //Python2.7 - Kivy// - Click Finish {{:tutorials:legacy:python_kivy:python_1.3.png?nolink|Python 1.3.png}} ==== 6. Add gwc_python module to project ==== The gwc_python module is the binding layer you will use to communicate with Gestureworks Core. - Right click on the new project in the Package Explorer and then click Import. Select //General → File System//. - Browse to the folder containing the downloaded Gestureworks Core files, navigate to the Python bindings folder and select //gwc_python//. - Select all files, including the containing folder. - Check the //Create complete folder structure// box. - Click Finish {{:tutorials:legacy:python_kivy:python_1.4.png?nolink|Python 1.4.png}} The gwc_python module is now added to the project in Eclipse: {{:tutorials:legacy:python_kivy:python_1.5.png?nolink|Python 1.5.png}} ---- ===== Review ===== In this tutorial we installed GestureWorks Core, the prerequisites for developing with the GestureWorks Core Python bindings, and created a project that includes the Python binding module. From here we move on to [[tutorials:legacy:python_kivy:getting_started_2_hello_multitouch|Python & Kivy: Getting Started II (Hello Multitouch)]] in which we dig into actual source code, initialize GestureWorks Core and work with touch event data. ---- Next tutorial: [[tutorials:legacy:python_kivy:getting_started_2_hello_multitouch|Python & Kivy: Getting Started II (Hello Multitouch)]]