- Trace your program:
apitrace trace python main.py
- Dump the trace:
apitrace dump python.2.7.trace > log
- Check for leaks:
python findleak.py log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.environ['KIVY_WINDOW'] = '' # noqa | |
from kivy.base import EventLoop, runTouchApp | |
from kivy.core.window import WindowBase | |
from kivy.graphics import Callback, opengl as gl | |
from kivy.lang import Builder | |
from kivy.properties import ObjectProperty | |
from direct.showbase.ShowBase import ShowBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSL= | |
_ssl _ssl.c \ | |
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ | |
-L$(SSL) -lssl$(OPENSSL_VERSION) -lcrypto$(OPENSSL_VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.base import runTouchApp | |
from kivy.lang import Builder | |
from kivy.factory import Factory as F | |
class DemoBox(F.ButtonBehavior, F.BoxLayout): | |
base_direction = F.StringProperty(None, allownone=True) | |
font_context = F.StringProperty(None, allownone=True) | |
font_size = F.NumericProperty(10) | |
runTouchApp(Builder.load_string(''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
Servo myservo; | |
int servoPin = 9; | |
int feedbackPin = 8; | |
void setup() { | |
pinMode(feedbackPin, INPUT); | |
pinMode(servoPin, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_distance_from_velocity_loop(self, vel, fri, dt=1 / 60.): | |
# original algo from tito | |
dist = 0 | |
it = 0 | |
while abs(vel) > .5: | |
it += 1 | |
vel -= vel * fri | |
dist += vel * dt | |
return dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from kivy.app import App | |
from kivy.factory import Factory | |
class TestApp(App): | |
def build(self): | |
return Factory.Button(text="Hello") | |
def reset(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import App | |
from kivy.lang import Builder | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import NumericProperty | |
kv = """ | |
<Row@BoxLayout>: | |
canvas.before: | |
Color: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Kivy audio implementation for Android using native API | |
====================================================== | |
""" | |
from jnius import autoclass | |
from kivy.core.audio import Sound, SoundLoader | |
MediaPlayer = autoclass("android.media.MediaPlayer") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from kivy.factory import Factory | |
from time import time | |
MAX_TIME = 2 | |
def time_bounded_perf(f): | |
def _time_bounded_perf(*args, **kwargs): |