Skip to content

Instantly share code, notes, and snippets.

class Renderer(Widget):
def __init__(self, fd, **kwargs):
self.instructions = InstructionGroup()
self.canvas = RenderContext(compute_normal_mat=True)
self.mesh1 = RenderContext(compute_normal_mat=True)
self.mesh1.shader.source = resource_find('shaders/red.glsl')
self.mesh2 = RenderContext(compute_normal_mat=True)
self.mesh2.shader.source = resource_find('shaders/blue.glsl')
import sys
sys.path.append('/home/asandy')
from matplotlib import rc
rc('font', **{'family':'serif','serif':['Computer Modern Roman']})
rc('text', usetex=True)
rc('axes', **{'labelsize':10})
rc('xtick', **{'labelsize':10})
rc('ytick', **{'labelsize':10})
print 'n is', n
print n.log10(5)
ax1.scatter(min_cs, n.log10(determinants), s=1.5, color='blue', alpha=0.5)
==================
Output:
n is <module 'numpy' from '/usr/lib/python2.7/site-packages/numpy/__init__.pyc'>
0.698970004336
Traceback (most recent call last):
('value is', '\n\n\n\n\nself.disabled_color if self.disabled else (self.color if not self.markup else (1, 1, 1, 1))')
('value is', '\n\n\n\n\n\n\nself.texture')
('value is', '\n\n\n\n\n\n\n\nself.texture_size')
('value is', '\n\n\n\n\n\n\n\n\nint(self.center_x - self.texture_size[0] / 2.), int(self.center_y - self.texture_size[1] / 2.)')
('value is', "\n\n\n\n\n\n\n\n\n\n\n\nself.background_normal if self.state == 'normal' else self.background_down")
('value is', "\n\n\n\n\n\n\n\n\n\n\n\n\nself.background_disabled_normal if self.state == 'normal' else self.background_disabled_down")
('value is', '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nself.background_color')
('value is', '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nself.border')
('value is', '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nself.pos')
('value is', '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nself.size')
def format_percent(number, format=None, locale='en_US'):
return '0.34%'
>>> format_percent(0.34/100, '#,###.##%', locale='en_US')
'0.34%'
asandy@homemade:~/kivy$ USE_SDL2=1 make
python2 setup.py build_ext --inplace
Environ change use_sdl2 -> True
[INFO ] Kivy v1.8.0-dev
Found GLES 2.0 headers at /usr/include/GLES2/gl2.h
SDL2: found SDL header at /usr/include/SDL2/SDL.h
SDL2: found SDL_mixer header at /usr/include/SDL2/SDL_mixer.h
SDL2: found SDL_ttf header at /usr/include/SDL2/SDL_ttf.h
SDL2: found SDL_image header at /usr/include/SDL2/SDL_image.h
running build_ext
@inclement
inclement / gist:33dde57f2f60b1524145
Created July 30, 2014 21:24
Example of changing texture wrap and tex_coords
'''
Example of changing texture properties and the properties
of its containing rectangle.
'''
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty, ListProperty, StringProperty
from kivy.lang import Builder
from kivy.clock import Clock
@inclement
inclement / gist:448b033e96080fefd24d
Created July 11, 2014 00:05
kivy infinite scrolling image example
from kivy.uix.widget import Widget
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.base import runTouchApp
class Scrolling(Widget):
def __init__(self, **kwargs):
super(Scrolling, self).__init__(**kwargs)
self.canvas.children[-1].texture.wrap = 'repeat'
BoxLayout:
AnchorLayout:
GridLayout:
size_hint_x: None
width: self.minimum_width
cols: 2
Image:
id: image
source: 'whatever'
size_hint_x: None
@inclement
inclement / gist:18519b8865abd62ff3f4
Created May 12, 2014 14:45
Kivy UrlRequest test
from kivy.lang import Builder
from kivy.base import runTouchApp
from kivy.network.urlrequest import UrlRequest
from kivy.uix.label import Label
class ShowyLabel(Label):
def get_input(self, *args):
print 'did get_input!'
print 'args are', args
self.text = str(args)