Skip to content

Instantly share code, notes, and snippets.

View gottadiveintopython's full-sized avatar

水戸う納豆齋(Nattōsai Mitō) gottadiveintopython

View GitHub Profile
@gottadiveintopython
gottadiveintopython / test_moretransitions.py
Last active January 29, 2022 02:03
kivy.garden.moretransitions が更新されたようなので試してみた
from kivy.app import runTouchApp
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.garden.moretransitions import (
PixelTransition, RippleTransition, BlurTransition, RVBTransition,
RotateTransition, TileTransition, FastSlideTransition,
)
ALL_TRANSITIONS = (
PixelTransition, RippleTransition, BlurTransition, RVBTransition,
@gottadiveintopython
gottadiveintopython / main.py
Last active November 10, 2018 07:12
tkinter版のyieldsleep
from functools import wraps
def yieldsleep(widget):
def func(create_gen):
@wraps(create_gen)
def func2(*args, **kwargs):
gen = create_gen(*args, **kwargs)
def sleep(milliseconds):
@gottadiveintopython
gottadiveintopython / readme.txt
Last active November 12, 2023 13:36
async/await with Kivy (MIT LICENSE)
Moved to https://github.com/asyncgui/asynckivy
@gottadiveintopython
gottadiveintopython / show_all_kivymd_icons.py
Last active August 23, 2024 23:29
Listing all icons available on KivyMD. You can easily see the name of an icon by pressing it.
'''
pip install kivy kivymd
'''
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivymd.app import MDApp
from kivymd.uix.label import MDLabel
from kivymd.uix.snackbar.snackbar import MDSnackbar
@gottadiveintopython
gottadiveintopython / manual_test_carousel2.py
Last active June 11, 2019 13:59
A tool for testing Carousel. It can dynamically change the properties.
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.app import runTouchApp
KV_CODE = '''
#:import random random
#:import Button kivy.uix.button.Button
<DebugCarousel@Carousel>:
@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]
@gottadiveintopython
gottadiveintopython / inverse_numpy_bincount.py
Created September 16, 2019 12:16
inverse numpy's bincount()
import numpy as np
import itertools
from timeit import timeit
arr = np.random.randint(3, size=100, dtype='uint8')
def method_me(arr):
return np.array(
tuple(itertools.chain.from_iterable(
itertools.repeat(index, value)
@gottadiveintopython
gottadiveintopython / main.py
Last active September 28, 2019 09:03
(Kivy) magnet + drag_n_drop = awesome
'''
https://youtu.be/fP0Pxy_3cSI
'''
from kivy.app import runTouchApp
from kivy.lang import Builder
from kivy.uix.label import Label
import rich_drag_n_drop
KV_CODE = '''
@gottadiveintopython
gottadiveintopython / Animation._instances keeps getting fat.py
Created September 29, 2019 11:46
"Animation._instances" keeps getting fat
'''
https://youtu.be/P2WtjZAWc8I
'''
from kivy.app import App
from kivy.factory import Factory
from kivy.animation import Animation
from kivy.clock import Clock
import itertools
anim_id_iter = itertools.count()