Skip to content

Instantly share code, notes, and snippets.

@kived
kived / orientation.kv
Created April 21, 2015 16:08
Kivy: orientation change
FloatLayout:
screen_orientation: 'landscape' if self.width > self.height else 'portrait'
BoxLayout:
orientation: 'vertical'
disabled: root.screen_orientation != 'portrait'
size_hint: (None, None) if self.disabled else (1, 1)
size: (0, 0) if self.disabled else (100, 100)
opacity: 0 if self.disabled else 1
@kived
kived / plottest.py
Created April 16, 2015 18:51
Kivy: glsl function plot test
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.uix.effectwidget import EffectWidget, AdvancedEffectBase
effect_plot = '''
uniform float scale_x, scale_y;
uniform float center_x, center_y;
@kived
kived / screentemplate.kv
Created April 11, 2015 17:37
Kivy: Screen template example
<ScreenTemplate@Screen>:
Button:
text: 'Button'
size_hint_y: None
height: sp(48)
ScreenManager:
ScreenTemplate:
name: 'screen1'
@kived
kived / confirmpopup.kv
Created March 30, 2015 21:53
Kivy: confirmation popup dialog
<-ConfirmPopup>:
GridLayout:
cols: 1
padding: '12dp'
pos_hint: {'center': (0.5, 0.5)}
size_hint_x: 0.66
size_hint_y: None
height: self.minimum_height
canvas:
@kived
kived / fontsize.py
Created March 30, 2015 18:49
Kivy: Label use maximum font_size
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
root = Builder.load_string('''
Label:
text: 'hello'
@kived
kived / linecont.py
Created March 26, 2015 19:51
Kivy: line continuations
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
Button:
text:
'hello'\\
@kived
kived / logtest-out.txt
Created March 25, 2015 22:13
logtest output
ryan@ryan-lappy:~/g/k/kivy (textinput-adv-movement:✖)$ python logtest.py
[WARNING] [Config ] Older configuration version detected (10 instead of 12)
[WARNING] [Config ] Upgrading configuration in progress.
[DEBUG ] [Config ] Upgrading from 10 to 11
[DEBUG ] [Config ] Upgrading from 11 to 12
[INFO ] [Logger ] Record log in /home/ryan/.kivy/logs/kivy_15-03-25_15.txt
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60s
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=Nones
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeout=60s
@kived
kived / logexample.txt
Created March 25, 2015 21:44
Kivy with Python logging output
[2015-03-25 16:43:58,828][INFO ] aeris2.registry.<module>:10: registry: logger
[2015-03-25 16:43:58,984][DEBUG] aeris2.Localization.__init__:42: Using Develop Path
[2015-03-25 16:43:58,984][INFO ] aeris2.Localization.__init__:48: initializing localization...
[2015-03-25 16:43:59,137][INFO ] aeris2.Localization.__init__:83: default language set to en_US
[WARNING] [Config ] Older configuration version detected (12 instead of 10)
[WARNING] [Config ] Upgrading configuration in progress.
[INFO ] [Logger ] Record log in /home/ryan/.kivy/logs/kivy_15-03-25_6.txt
[INFO ] [Factory ] 171 symbols loaded
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60s
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=Nones
@kived
kived / buildozer.spec
Created March 19, 2015 20:12
Kivy: RstTest for Android
[app]
# (str) Title of your application
title = RstTest
# (str) Package name
package.name = rsttest
# (str) Package domain (needed for android/ios packaging)
package.domain = org.kivy
@kived
kived / rotpy.py
Created March 17, 2015 17:36
Kivy: Rotation in Python
'''
Rotation Example
================
This example rotates a button using PushMatrix and PopMatrix. You should see
a static button with the words 'hello world' rotated at a 45 degree angle.
'''
from kivy.app import App