Skip to content

Instantly share code, notes, and snippets.

@bartoszxkozlowski
bartoszxkozlowski / TouchRippleButton.py
Last active September 11, 2020 12:10
Simple modification of a Kivy button which utilizes TouchRippleBehavior class in order to display the ripple animation only in specified area. This allows user to create buttons with bigger touch area than the graphic's area and still maintain proper ripple display.
from kivy.uix.behaviors.touchripple import TouchRippleBehavior
from kivy.clock import Clock
from kivy.uix.button import Button
from kivy.animation import Animation
from kivy.uix.relativelayout import RelativeLayout
from kivy.graphics import Color, Ellipse, ScissorPush, ScissorPop
from kivy.properties import BooleanProperty, ListProperty
class TouchRippleButton(TouchRippleBehavior, Button):
@bartoszxkozlowski
bartoszxkozlowski / showborder.py
Created May 6, 2020 09:53
Simple modification of existing Kivy's showborder module. The default code implements white dashed borders of the widgets. This particular modification implements random colors of the borders, from #000000 to #969696, and disables the dashing.
'''
Show border
===========
Shows widget's border.
The idea was taken from
http://robertour.com/2013/10/02/easy-way-debugging-kivy-interfaces/
'''
@bartoszxkozlowski
bartoszxkozlowski / RefLabel.py
Created April 7, 2020 12:53
Simple modification of a Kivy's Label widget, which provides the "touch up" behavior for the reference markup.
from kivy.clock import Clock
from kivy.uix.label import Label
class RefLabel(Label):
__events__ = ['on_ref_relase']
def on_touch_up(self, touch):
if super(Label, self).on_touch_up(touch):
return True