Skip to content

Instantly share code, notes, and snippets.

@el3
el3 / threading_example.py
Last active April 16, 2024 22:01
threading in kivy example
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import StringProperty
from kivy.clock import mainthread
import threading
import time
@el3
el3 / selectable_multicolumn_recycle.py
Created May 26, 2020 13:37
A multi column recycleview with selectable rows.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.recycleview import RecycleView
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.recycleview.views import RecycleDataViewBehavior
from kivy.uix.label import Label
from kivy.properties import BooleanProperty
from kivy.uix.recycleboxlayout import RecycleBoxLayout
from kivy.uix.behaviors import FocusBehavior
from kivy.uix.recycleview.layout import LayoutSelectionBehavior
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.floatlayout import FloatLayout
from kivy.graphics import Line, Color
from kivy.vector import Vector
from kivy.core.window import Window
from functools import partial
from random import randint
import threading
@el3
el3 / longtext_linenumbers.py
Last active April 5, 2023 11:06
Long text split by "\n" and put into labels, with line numbers, in recycleview
from kivy.app import App
from kivy.properties import ListProperty
from kivy.lang import Builder
long_text = 'This is an example to output a very long file as labels in a recycleboxlayout with line numbers and proper line breakings\n' * 1000 + " END"
KV = '''
<MyLabel@Label>:
halign: "left"
@el3
el3 / longtext2.py
Last active April 5, 2023 11:05
Long text split by "\n" put into labels in recycleview
from kivy.app import App
from kivy.properties import ListProperty
from kivy.lang import Builder
long_text = 'This is an example to output a very long file as labels in a recycleboxlayout with line numbers and proper line breakings\n' * 1000 + " END"
KV = '''
<MyLabel@Label>:
halign: "left"
@el3
el3 / datepicker.py
Created August 30, 2020 23:59
datepicker for kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
KV = """
#:import Calendar calendar.Calendar
<Day@Button>:
datepicker: self.parent.datepicker
color: [1,1,1,1]
@el3
el3 / recycle_checkboxes.py
Last active July 27, 2022 09:57
Kivy CheckBoxes in RecycleView
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.recycleview import RecycleView
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.recycleview.views import RecycleDataViewBehavior
from kivy.properties import BooleanProperty
KV = '''
<Row>:
active: cb.active
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.uix.label import Label
from kivy.uix.behaviors import ButtonBehavior
class MyLabel(ButtonBehavior, Label):
cursor_blink = True
cur = "[color=ff3333]|[/color]"
@el3
el3 / function_lines.py
Last active December 19, 2020 15:48
A kivy example, that will take touch inputs as input, and will fit a function to the points, and draw a line. With slider to test higher orders. And textinputs, where you can use arrow up and down to adjust numbers
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.graphics import Line, Ellipse, Color
from kivy.properties import ListProperty, StringProperty, NumericProperty
from kivy.core.window import Window
import numpy as np
@el3
el3 / db.py
Last active April 12, 2020 00:31
Sqlite3
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
con = lite.connect('test.db')
cur = con.cursor()
try:
with con: