Skip to content

Instantly share code, notes, and snippets.

View tshirtman's full-sized avatar

Gabriel Pettier tshirtman

View GitHub Profile
@tshirtman
tshirtman / rv_visible.py
Created March 23, 2021 22:09
recycleview behind the scene
'''
'''
from kivy.app import App
from kivy.lang import Builder
KV = '''
#:import get_random_color kivy.utils.get_random_color
<-StencilView>:
@tshirtman
tshirtman / test_hold.py
Last active October 5, 2021 09:25
Simple implementation of a hold behavior for buttons.
'''
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.clock import Clock
from kivy.properties import NumericProperty
KV = '''
'''
'''
from kivy.app import App
from kivy.lang import Builder
KV = '''
BoxLayout:
orientation: 'vertical'
'''
'''
from kivy.app import App
from kivy.lang import Builder
KV = '''
FloatLayout:
GridLayout:
cols: 3
@tshirtman
tshirtman / autofit_ti.py
Created January 10, 2021 01:20
kivy text input with automatic font size for biggest text that fits
'''
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.core.text import Text
from kivy.clock import mainthread
KV = '''
TextInput:
'''
'''
from kivy.app import App
from kivy.lang import Builder
KV = '''
#:import choices random.choices
#:import printable string.printable
'''Demonstrate showing a cropped image using get_region
Drop any image supported by kivy on the window and play with the sliders
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
from kivy import properties as P
'''Theme object example
'''
from kivy.app import App
from kivy.lang import Builder
from kivy import properties as P
from kivy.lang.parser import global_idmap
from kivy.event import EventDispatcher
KV = '''
'''Simulate a specific device that is not in kivy's screen module
'''
width = 1480
height = 720
dpi = 274
density = 1
scale = .5
portrait = True
if portrait:
from random import randint
from datetime import datetime, timedelta
from math import log10, ceil
from kivy.app import App
from kivy.animation import Animation
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.factory import Factory
from kivy import properties as P