This file contains hidden or 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
| ''' | |
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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 format_percent(number, format=None, locale='en_US'): | |
| return '0.34%' | |
| >>> format_percent(0.34/100, '#,###.##%', locale='en_US') | |
| '0.34%' |
This file contains hidden or 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
| ('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') |
This file contains hidden or 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
| 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): |
This file contains hidden or 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 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}) |
This file contains hidden or 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
| 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') |
This file contains hidden or 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
| <PartBox@BoxLayout>: | |
| ti: ti | |
| orientation: 'vertical' | |
| size_hint_x: 0.2 | |
| title: '' | |
| Label: | |
| text: root.title | |
| TextInput: | |
| id: ti | |
| text: '0' |
This file contains hidden or 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 1.0.9 | |
| TestWidget: | |
| <RectangleWidget@Widget>: | |
| source: '' | |
| canvas: | |
| Color: | |
| rgba: 1, 1, 1, 1 | |
| Rectangle: | |
| pos: self.pos |
This file contains hidden or 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.uix.boxlayout import BoxLayout | |
| from kivy.lang import Builder | |
| Builder.load_string(''' | |
| <MainWidget>: | |
| BoxLayout: | |
| orientation: 'vertical' | |
| Button: | |
| text: 'some string ' |