Skip to content

Instantly share code, notes, and snippets.

View me2beats's full-sized avatar

Albert me2beats

  • Russia, Yekaterinburg
View GitHub Profile
@YuriSizov
YuriSizov / NodeUtils.gd
Last active December 19, 2021 19:50
A sample code for Godot Editor plugin to play an arbitrary scene from GDScript
extends Object
class_name NodeUtils
static func get_child_by_class(node : Node, child_class : String, counter : int = 1) -> Node:
var match_counter = 0
var node_children = node.get_children()
for child in node_children:
if (child.get_class() == child_class):
match_counter += 1
@tshirtman
tshirtman / __init__.py
Last active November 15, 2019 02:48
animated voronoi of mona lisa
from random import random
from itertools import chain
from kivy.uix.effectwidget import AdvancedEffectBase
from kivy.animation import Animation
from kivy.clock import Clock
from kivy.properties import ListProperty
from kivy.core.window import Window
Window.size = 300, 400
@tshirtman
tshirtman / slowdown.py
Last active May 24, 2021 10:52
A Spinner/DropDown that opens progressively by animationg opacity of the items.
from kivy.uix.dropdown import DropDown
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import NumericProperty
from kivy.animation import Animation
KV = '''
FloatLayout:
Spinner:
dropdown_cls: 'SlowDown'
@dzil123
dzil123 / args.py
Created August 6, 2019 17:43
Reference the value of other arguments in your function definitions
import functools
import inspect
import itertools
import typing
class Arg(typing.NamedTuple):
name: str
@gottadiveintopython
gottadiveintopython / example1.py
Last active July 29, 2019 00:44
listing the children that will be added by Builder
__all__ = ('get_tree_from_widget', 'get_tree_from_root_rule', 'get_tree_from_cls', )
from kivy.lang import Parser, Builder, BuilderBase
from kivy.factory import Factory
def _get_children(rule):
return [{crule.name: _get_children(crule)} for crule in rule.children]
from kivy.app import App
from kivy.base import runTouchApp
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.properties import ListProperty
from kivy.core.window import Window
from colorsys import hls_to_rgb
class ColourApp(App):
@tshirtman
tshirtman / fixed_rv.py
Last active April 6, 2021 17:40
Example of a RecycleView that keeps the current view position when new data is added, unless we are at the very bottom, in which case we follow the scroll.
from random import sample, randint
from string import ascii_lowercase
from time import asctime
from kivy.app import App
from kivy.factory import Factory
from kivy.lang import Builder
from kivy.properties import NumericProperty, ListProperty
from kivy.clock import Clock
from array import array
from kivy.app import App
from kivy.lang import Builder
from kivy.graphics.fbo import Fbo
from kivy.graphics.texture import Texture
from kivy.uix.widget import Widget
from kivy.properties import ListProperty, ObjectProperty
KV = '''
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.properties import ListProperty
from kivy.animation import Animation
KV = '''
#:import RGBA kivy.utils.rgba
<ImageButton@ButtonBehavior+Image>:
from kivy.lang import Builder
from kivy.app import App
from kivy.properties import ListProperty, NumericProperty
KV = '''
#:import RGBA kivy.utils.rgba
<Row@BoxLayout>:
text: ''
rv_key: 0