Skip to content

Instantly share code, notes, and snippets.

View matham's full-sized avatar

Matt Einhorn matham

View GitHub Profile
Matthew Einhorn@Dove-TDSkope MINGW64 /g/Python/py4a/builds
$ CCACHE_DISABLE=1 time p4a apk --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python2 --storage-dir=/g/python/py4a/builds/storage --arch=armeabi-v7a
--debug
[INFO]: Will compile for the following archs: armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI
['E:\\Android\\sdk\\tools\\android.bat', 'list'] None
[INFO]: Available Android APIs are (23, 25)
[INFO]: Requested API target 23 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK
[INFO]: Got NDK version from $ANDROIDNDKVER
def schmitt_trigger(up, high, down, low, data):
'''up is the value that when we're in low state and we hit the up value we'll go into up (going up) state.
high is the value that when we're in up state and we hit the high value we'll go into high state.
down is the value that when we're in high state and we hit the down value we'll go into down (going down) state.
low is the value that when we're in down state and we hit the low value we'll go into low state.
data is list of data values.
'''
result = []
for s, val in enumerate(data):
if val < low:
'''
Widget animation
================
This example demonstrates creating and applying a multi-part animation to
a button widget. You should see a button labelled 'plop' that will move with
an animation when clicked.
'''
from os import environ
environ['KIVY_CLOCK'] = 'interrupt'
from os import listdir
from os.path import join, splitext
from re import match
import re
import numpy as np
import operator
from glitter.logger import DataLogger
filename_pat = re.compile('Carvone Trial([0-9]+) +([0-9]+)_updated_\\.h5')
import csv
import numpy as np
import matplotlib.pylab as plt
import matplotlib
from datetime import datetime
def import_data(filename, n_wheels):
with open(filename) as fh:
reader = csv.reader(fh, delimiter='\t')
# -*- coding: utf-8 -*-
# Compiled from G:\python\dev2\kivy\kivy\data\style.kv at 2016-03-26 20:32:24.225000
__version__ = "0.1"
__kivy_version__ = "1.9.2-dev0"
__source_file__ = r"G:\python\dev2\kivy\kivy\data\style.kv"
__source_hash__ = b"2be232fc91a3d3aef68443c29d58d15f68a92b96557972c6c04dcb788c973c88"
import kivy.metrics as __Metrics
from kivy.factory import Factory
$ grep -r ", \\-1)" kivy/* --include="*.py"
kivy/clock.py: Clock.schedule_once(my_callback, -1) # call before the next frame
kivy/core/window/__init__.py: self.create_window, -1)
kivy/interactive.py: Clock.schedule_once(safeWait, -1)
kivy/tests/test_clock.py: Clock.schedule_once(callback, -1)
kivy/uix/accordion.py: self._trigger_title = Clock.create_trigger(self._update_title, -1)
kivy/uix/accordion.py: Clock.create_trigger(self._do_layout, -1)
kivy/uix/carousel.py: self._position_visible_slides, -1)
kivy/uix/label.py: self._trigger_texture = Clock.create_trigger(self.texture_update, -1)
kivy/uix/layout.py: self._trigger_layout = Clock.create_trigger(self.do_layout, -1)
@setlocal enableextensions enabledelayedexpansion
@echo off
REM Script that tries to find python in the registry and
REM adds it to the path. It uses the filename to find the
REM version of python to use. If `x64` or `_64` is in the
REM filename, then the 64 bit version of python is used.
REM Also, if e.g. 27 is in the filename, it loads python
REM 2.7. Similarly for other python versions.
REM NOTE: When installing as user rather than global,
@matham
matham / sdl2
Created November 23, 2015 19:02
import sys
from os.path import dirname, join, isdir
import ctypes
from ctypes import wintypes
# See https://github.com/numpy/numpy/wiki/windows-dll-notes#python-dlls
# and https://pytools.codeplex.com/workitem/1627
try:
_AddDllDirectory = ctypes.windll.kernel32.AddDllDirectory
_AddDllDirectory.argtypes = [wintypes.c_wchar_p]
from kivy.lang import Builder
from kivy.app import runTouchApp
from kivy.clock import Clock
kv = '''
VideoGrid
<VideoGrid@BoxLayout>:
source: r'G:\\Python\\dev2\\kivy27\\examples\\widgets\\softboy.mpg'
state: 'stop'