Skip to content

Instantly share code, notes, and snippets.

View amalgamatedclyde's full-sized avatar

Clyde Tressler amalgamatedclyde

View GitHub Profile
@amalgamatedclyde
amalgamatedclyde / gist:8737465
Created January 31, 2014 17:27
multiple kv
def build(self):
l= Builder.load_file('newui.kv')
m= Builder.load_file('studentlist3.kv')
carousel.add_widget(l)
carousel.add_widget(m)
self.m = m
self.l = l
self.rootlayout = rootlayout
self.carousel = carousel
@amalgamatedclyde
amalgamatedclyde / gist:8916255
Last active August 29, 2015 13:56
this works on linux but not android.
def change_image(instance, photo):
"""open selected image, resize and blit into texture"""
global currentTexture
##try:
img = PILImage.open(instance.selection[0])
##print img
currentTexture = Texture.create(size= (180,240))
img2 = img.resize((180,240), PILImage.BICUBIC)
buf = img2.tostring()
currentTexture.blit_buffer(buf, colorfmt='rgb', bufferfmt='ubyte')
@amalgamatedclyde
amalgamatedclyde / gist:9273885
Created February 28, 2014 16:16
blit_buffer problem
def change_image(instance, photo, image_slider):
"""open selected image, resize and blit into texture"""
global currentTexture
try:
img = PILImage.open(instance.selection[0])
except: pass
img = img.resize((180,240), PILImage.BICUBIC)
buf = img.tostring()
with open('buffer.txt', 'w') as f:
f.write(buf)
@amalgamatedclyde
amalgamatedclyde / gist:9621360
Created March 18, 2014 14:39
in this case: self.cb = Callback(self.setup_gl_context) There are 3 instances of Callback in memory and they all reference a list that keeps growing whenever the scene is updated
def setup_gl_context(self, *args):
#clear_buffer
glEnable(GL_DEPTH_TEST)
self.fbo.clear_buffer()
@amalgamatedclyde
amalgamatedclyde / gist:9689351
Created March 21, 2014 15:55
using Color() in a frame buffer object
#this draws a magenta ellipse:
c = Ellipse(size = (200,279), pos = (220,118))
with self.fbo:
Color(1,0,1,1)
c
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Rectangle(size = (640,480), texture = self.tex.texture)
@amalgamatedclyde
amalgamatedclyde / gist:9709409
Created March 22, 2014 15:57
why does the frame rate slow down?
def new_color(self, *args):
with self.fbo:
Color(self.mood[0], self.mood[1],self.mood[2],self.mood[3])
Ellipse(size = (205,279), pos = (224,115))
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Rectangle(size = (640,480), texture = self.tex.texture)
@amalgamatedclyde
amalgamatedclyde / gist:9722139
Last active August 29, 2015 13:57
why does this kill the framerate?
import kivy
from kivy.app import App
from kivy.clock import Clock
from kivy.graphics import Rectangle, Ellipse
from kivy.uix.widget import Widget
from kivy.graphics.fbo import Fbo
from kivy.utils import get_random_color
from kivy.animation import Animation
from kivy.core.image import Image
from kivy.graphics import Color
------------------------------------------------------------
/home/clyde/camapp/.buildozer/venv/bin/pip run on Fri Apr 4 10:31:22 2014
Downloading/unpacking kivy
Getting page https://pypi.python.org/simple/kivy/
URLs to search for versions for kivy:
* https://pypi.python.org/simple/kivy/
Analyzing links from page https://pypi.python.org/simple/Kivy/
Found link https://pypi.python.org/packages/source/K/Kivy/Kivy-1.0.1-alpha.tar.gz#md5=3610522fce080ccf91c4ea6beb14f706 (from https://pypi.python.org/simple/Kivy/), version: 1.0.1-alpha
Found link https://pypi.python.org/packages/source/K/Kivy/Kivy-1.0.2-alpha.tar.gz#md5=779ae7b1e62195647e314d86b3a98bcd (from https://pypi.python.org/simple/Kivy/), version: 1.0.2-alpha
@amalgamatedclyde
amalgamatedclyde / gist:10121091
Created April 8, 2014 13:05
fails in buildozer script. runs when i enter it in the command line
pip install --download-cache=/home/clyde/.buildozer/cache --target=/home/clyde/camapp/.buildozer/applibs kivy
@amalgamatedclyde
amalgamatedclyde / gist:10126025
Created April 8, 2014 13:43
cython is missing???
------------------------------------------------------------
/home/clyde/camapp/.buildozer/venv/bin/pip run on Tue Apr 8 09:31:31 2014
Downloading/unpacking kivy
Getting page https://pypi.python.org/simple/kivy/
URLs to search for versions for kivy:
* https://pypi.python.org/simple/kivy/
Analyzing links from page https://pypi.python.org/simple/Kivy/
Found link https://pypi.python.org/packages/source/K/Kivy/Kivy-1.0.1-alpha.tar.gz#md5=3610522fce080ccf91c4ea6beb14f706 (from https://pypi.python.org/simple/Kivy/), version: 1.0.1-alpha
Found link https://pypi.python.org/packages/source/K/Kivy/Kivy-1.0.2-alpha.tar.gz#md5=779ae7b1e62195647e314d86b3a98bcd (from https://pypi.python.org/simple/Kivy/), version: 1.0.2-alpha
Found link https://pypi.python.org/packages/source/K/Kivy/Kivy-1.0.3-alpha.tar.gz#md5=dbd113ef52f7430ec92053a8f6f61588 (from https://pypi.python.org/simple/Kivy/), version: 1.0.3-alpha