Skip to content

Instantly share code, notes, and snippets.

View amalgamatedclyde's full-sized avatar

Clyde Tressler amalgamatedclyde

View GitHub Profile
@amalgamatedclyde
amalgamatedclyde / gist:8185603
Created December 30, 2013 18:12
atlas fails at 50596px but succeeds at 36400
[INFO ] Logger: Record log in /home/clyde/.kivy/logs/kivy_13-12-30_14.txt
[INFO ] Kivy v1.8.0-dev
[INFO ] Atlas: create an 50596x50596 rgba image
[WARNING ] stderr: Traceback (most recent call last):
[WARNING ] stderr: File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
[WARNING ] stderr: "__main__", fname, loader, pkg_name)
[WARNING ] stderr: File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
[WARNING ] stderr: exec code in run_globals
[WARNING ] stderr: File "/usr/lib/python2.7/dist-packages/kivy/atlas.py", line 388, in <module>
[WARNING ] stderr: ret = Atlas.create(outname, filenames, size, use_path=use_path)
@amalgamatedclyde
amalgamatedclyde / gist:8257202
Created January 4, 2014 16:41
if i add the gridlayout directly to the scrollview instead of adding it to the relative layout the scroll works
import kivy
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.uix.button import Button
@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