Skip to content

Instantly share code, notes, and snippets.

View amalgamatedclyde's full-sized avatar

Clyde Tressler amalgamatedclyde

View GitHub Profile
@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: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: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: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: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: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:8163247
Created December 28, 2013 19:35
i did not write this code. it was a demo posted somewhere
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.camera import Camera
from kivy.uix.button import Button
from kivy.core.window import Window
class MyApp(App):
@amalgamatedclyde
amalgamatedclyde / gist:7894289
Created December 10, 2013 17:12
here is an example
mylistobj.adapter = ListAdapter(data= sorted([item[0]+','+ item[1] for item in missing]), args_converter= args_conv, cls= ListItemButton)
I/python (14371): File "/home/clyde/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/uix/textinput.py", line 1009, in on_focus
I/python (14371): File "/home/clyde/buildozer/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 378, in request_keyboard
I/python (14371): File "_android.pyx", line 190, in android._android.show_keyboard (android/_android.c:2286)
I/python (14371): TypeError: show_keyboard() takes exactly 2 positional arguments (0 given)
I/python (14371): Python for android ended.
I/AndroidRuntime(14371): VM exiting with result code 0, cleanup skipped.
clyde@clyde-N55SF:/home/kivy$ sudo make
python setup.py build_ext --inplace
[INFO ] Kivy v1.8.0-dev
Found GLES 2.0 headers at /usr/include/GLES2/gl2.h
running build_ext
Build configuration is:
* use_opengl_es2 = True
* use_sdl = False
* use_glew = False
* use_rpi = False