Skip to content

Instantly share code, notes, and snippets.

@kived
kived / background.py
Created March 16, 2015 18:00
Kivy: background color example
<BackgroundWidget@Widget>:
background_color: 1, 0, 0, 1
canvas.before:
Color:
rgba: root.background_color
Rectangle:
pos: self.pos
size: self.size
@kived
kived / texcoords.py
Created March 15, 2015 01:17
Kivy: tex_coords
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
BoxLayout:
Widget:
canvas:
@kived
kived / gist:f9462ecf3cb18c2df101
Created March 9, 2015 16:35
Kivy: kwargs ignored for properties set via kv
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.button import Button
Builder.load_string('''
<Button>:
text: 'bad'
@kived
kived / sudoku.py
Last active August 26, 2023 10:13
Kivy Sudoku
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.properties import NumericProperty, AliasProperty, ObjectProperty
from kivy.event import EventDispatcher
@kived
kived / aptly-process-incoming.py
Created March 3, 2015 22:44
aptly: import from .changes files
#!/usr/bin/env python3
REPO_FORMAT = 'eepa-{dist}-build'
import sys
import os, os.path
import hashlib
import subprocess
def parse_changes(filename):
@kived
kived / widgetaccess.kv
Created February 26, 2015 22:48
Kivy: accessing another widget
<InnerWidget@BoxLayout>:
textinput: ti
Label:
text: 'hello'
TextInput:
id: ti
<OuterWidget@BoxLayout>:
InnerWidget:
id: inner
@kived
kived / squaretest.py
Last active August 29, 2015 14:16
Kivy: square box test
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
BoxLayout:
orientation: 'vertical'
@kived
kived / centergrid.py
Last active August 29, 2015 14:15
Kivy: centered grid
import kivy
kivy.require('1.8.1')
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
BoxLayout:
orientation: 'vertical'
Label:
@kived
kived / lxc-nat.py
Created February 13, 2015 19:09
LXC NAT tool
#!/usr/bin/env python3
'''
lxc-nat.py: Simple Python script to create port-forwarding rules based on a static table.
Configuration
=============
Create /etc/lxc/lxc-nat.json with rules such as the following:
::
@kived
kived / main.py
Created February 9, 2015 20:15
Kivy: Android keep screen on
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.lang import Builder
from jnius import autoclass
PythonActivity = autoclass('org.renpy.android.PythonActivity')
View = autoclass('android.view.View')
Params = autoclass('android.view.WindowManager$LayoutParams')