Skip to content

Instantly share code, notes, and snippets.

View gottadiveintopython's full-sized avatar

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

View GitHub Profile
@gottadiveintopython
gottadiveintopython / fastfilechooser.py
Last active October 20, 2019 14:56
simple and fast FileChooser
import typing
from pathlib import Path
from dataclasses import dataclass
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.factory import Factory
from kivy.properties import ObjectProperty, BooleanProperty
@dataclass
@gottadiveintopython
gottadiveintopython / mdfastfilechooser.py
Last active October 23, 2019 05:48
Fast FileChooser (KivyMD)
import typing
from pathlib import Path
from dataclasses import dataclass
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.factory import Factory
from kivy.properties import ObjectProperty, BooleanProperty
try:
from kivymd.uix.dialog import MDDialog
from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
KV = '''
#:import A kivy.animation.Animation
<AutoScaleLabel@Label>:
scale: 1
@gottadiveintopython
gottadiveintopython / manual_test_recyclegridlayout.py
Last active May 31, 2020 03:33
manually tests RecycleGridLayout
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.factory import Factory
from kivy.app import runTouchApp
from kivy.uix.recyclegridlayout import RecycleGridLayout
internal_attr_names = (
'_has_hint_bound_x',
'_has_hint_bound_y',
"""TODO: ctrl + left/right (move past word), ctrl + backspace/del (del word), shift + del (del line)
...: Smart movement through leading indentation.
...: Except for first line, up/down to work normally on multi-line console input.
"""
from code import InteractiveConsole
from collections import deque
from dataclasses import dataclass
from io import StringIO
from itertools import chain, takewhile
import sys
@gottadiveintopython
gottadiveintopython / wobblywidget.py
Created May 14, 2020 17:27 — forked from salt-die/wobblywidget.py
Make any widget wobble with wobbly widget!
"""For this to work, WobblyEffect should be parent to WobblyScatter.
Try setting WobblyScatter `size_hint = (None, None)` or `size = self.parent.size`
if having size issues.
"""
from kivy.clock import Clock
from kivy.uix.effectwidget import AdvancedEffectBase, EffectWidget
from kivy.uix.scatter import Scatter
from kivy.uix.widget import Widget
from itertools import product
@gottadiveintopython
gottadiveintopython / noglobal.py
Created December 6, 2020 15:39 — forked from ax3l/noglobal.py
Useful Noglobal in Python
# License:
# I hereby state this snippet is below "threshold of originality" where applicable (public domain).
#
# Otherwise, since initially posted on Stackoverflow, use as:
# CC-BY-SA 3.0 skyking, Glenn Maynard, Axel Huebl
# http://stackoverflow.com/a/31047259/2719194
# http://stackoverflow.com/a/4858123/2719194
import types
@gottadiveintopython
gottadiveintopython / noglobal.py
Created December 6, 2020 15:41 — forked from yoshipon/noglobal.py
Useful Noglobal in Python
# License:
# I hereby state this snippet is below "threshold of originality" where applicable (public domain).
#
# Otherwise, since initially posted on Stackoverflow, use as:
# CC-BY-SA 3.0 skyking, Glenn Maynard, Axel Huebl
# http://stackoverflow.com/a/31047259/2719194
# http://stackoverflow.com/a/4858123/2719194
import types
import inspect
@gottadiveintopython
gottadiveintopython / chat_viewer.py
Last active March 18, 2022 03:46
RecycleViewを使ってchat viewerを実装
import itertools
from string import Template
from collections import defaultdict
from kivy.config import Config
Config.set('graphics', 'width', 400)
Config.set('graphics', 'height', 800)
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.utils import escape_markup
from kivy.clock import Clock
@gottadiveintopython
gottadiveintopython / shiled.py
Created August 11, 2021 22:20 — forked from tshirtman/Overworld.png
a tilemap implementation in kivy using a shader
from array import array
from kivy.uix.widget import Widget
from kivy.clock import Clock
from kivy import properties as P
from kivy.graphics import (
RenderContext, BindTexture, Rectangle, Color
)
from kivy.graphics.texture import Texture
from kivy.core.window import Window