Skip to content

Instantly share code, notes, and snippets.

View matham's full-sized avatar

Matt Einhorn matham

View GitHub Profile
@matham
matham / kivy-env.py
Last active August 29, 2015 14:05
Create windows portable python for kivy
from __future__ import print_function
import subprocess
import sys
import os
from os import makedirs, listdir, remove, rename
from os.path import exists, join, abspath, isdir, isfile, splitext
import argparse
from subprocess import Popen, PIPE
from shutil import rmtree, copytree, copy2
from glob import glob
@matham
matham / subplots.py
Created March 2, 2015 22:25
subplots
from kivy.app import runTouchApp
from kivy.garden.graph import Graph
from kivy.uix.gridlayout import GridLayout
from kivy.properties import ObjectProperty, ListProperty, DictProperty
from kivy.clock import Clock
class GraphContainer(GridLayout):
finish_redraw_trigger = None
import time
from time import sleep
from threading import Thread
import tables as tb
from os.path import exists, isfile
from functools import partial
from re import match, compile
from Queue import Queue
from pybarst.core.server import BarstServer
@matham
matham / scroll.py
Created March 11, 2015 00:37
scroll
from kivy.app import runTouchApp
from kivy.lang import Builder
from kivy.uix.textinput import TextInput
class TabTextInput(TextInput):
def __init__(self, *args, **kwargs):
super(TabTextInput, self).__init__(*args, **kwargs)
@matham
matham / style.kvc
Created May 27, 2015 21:08
compiler
# -*- coding: utf-8 -*-
# Compiled from G:\Python\dev2\kivy\kivy\data\style.kv at 2015-05-27 01:56:28.807000
__version__ = "1.9.1-dev"
__source_file__ = r"G:\Python\dev2\kivy\kivy\data\style.kv"
__source_hash__ = b"30344218c5162f5a94729242fbdf35fe1b86f4376d47c9cef55455e97ee2c3cc"
import kivy.metrics as Metrics
from kivy.factory import Factory
from kivy.lang import (
#:import color kivy.utils.get_color_from_hex
#:import sp kivy.metrics.sp
#:import sin math.sin
#:import chain itertools.chain
#:set title_color '009688'
#:set title_underline 'b2dfdb'
#:set subtitle_color '00bcd4'
#:set subtitle_underline 'b2ebf2'
#:set default_color (0, 0, 0, 1)
#:set background_color 'e0f7fa'
from functools import partial
from kivy.config import Config
Config.set('modules', 'inspector', '')
from kivy.garden.recycleview import RecycleView, RecycleViewMixin, LayoutChangeException
from kivy.lang import Builder
from kivy.app import App
from kivy.factory import Factory
from kivy.animation import Animation
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'
@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]
@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,