This is a simple GUI app for the generation of 2d mouse input data. It is built using Kivy.
Demonstration video:
The Mouse Drawing App uses Kivy, which will only install with Cython <=0.23 and >=0.26.1. You can check your current version with:
pip freeze | grep Cython
If present and not adequate, uninstall your current Cython.
pip uninstall Cython
Install the a correct Cython version.
pip install Cython==0.26.1
You can safely reinstall your other Cython version after the installation.
Make sure pypiwin32
is installed.
pip install pypiwin32
After cloning the repository, install dependencies using:
pip install -r requirements.txt
Note: The above-mentioned dependencies have been tested for an installation of a new Python 3.7.9 environment installed from Conda 4.10.3. Other versions of Python may additionally require installation of:
kivy.deps.sdl2
kivy.deps.glew
kivy.deps.angle
After the you have the necessary dependencies installed, run:
python setup.py install
Basic usage guide:
- Run drawing_app.py.
python drawing_app.py
A small GUI window should open.
- Click "Draw" to be taken to another screen with buttons on the top and a black background.
- Click and drag your cursor to draw on the canvas. As you do, your cursor's relative position (X, Y) on the screen will be printed in the Python console. Position 0, 0 is Left, Bottom, and position 1, 1 is Right, Top.
- When you release your cursor, the line drawing should stop.
- Click the button labelled 'save' (or press 's' on your keyboard) to save the cursor positions you just drew (and which were just printed in the console) to a CSV file in the directory of drawing_app.py. By default, this file will be called "touch_data1.csv" (you can change the default filename in the options menu).
- You may continue to draw and save a second file, i.e. "touch_data2.csv", and/or clear your current drawing at any point using the button labelled 'clear' (or by pressing 'c' on your keyboard).
Using other features:
- Hover draw: by default, press 'h' on your keyboard to start a hover drawing and press 'h' again to complete it.
- Loading drawings: currently, the load function just gets the most recently-saved drawing using the current filename and file index number, e.g. "touch_data1.csv". While the program is running, you can manually place and replace csv to load them as you wish.
Buglist (as of 18 April 2018):
- Clicking during the short fading animation between screens can cause the program to crash.
- Keypresses don't register on the draw screen until there has been a touch on the screen.
- Screen resolution is not updated in the options menu if the user manually changes the window size.
- Copy/paste bugs in text fields of 'options' menu. This is a known Kivy issue (see here and here) and the fix will be available in the Kivy master branch soon.
Other known issues:
- Incompatible with IPython/Jupyter Notebook (this is a general limitation of the Kivy module used in this app). It was possible to use Kivy in Jupyter Notebook since Kivy version 1.3.0 using InteractiveLauncher. However, this has been deprecated since version 1.10.0. Also see here.
- When drawing_app.py is run from Spyder, you will need to set the run options so that it runs in a dedicated console. To do this, go to "Run" > "Configuration per file ..." or use Ctrl+F6 and under "Console" select "Execute in a dedicated console". When you run and then close the program, you will need to also close the new console terminal before re-launching (or execute drawing_app.py within a new console).