Skip to content

Instantly share code, notes, and snippets.

__author__ = 'Alan'
__version__ = '0.1'
import kivy
kivy.require("1.0.0")
from kivy.app import Builder
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.scrollview import ScrollView
__author__ = 'Alan'
__version__ = '0.1'
import kivy
kivy.require("1.0.0")
from kivy.app import Builder
from kivy.app import App
from kivy.clock import Clock
@Alan-FGR
Alan-FGR / gloproblem.py
Last active August 29, 2015 14:27
kivy gridlayout problem
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.app import Builder, App
from random import randint
Builder.load_string("""
<GridLayout>:
@Alan-FGR
Alan-FGR / gloproblem.py
Created August 14, 2015 17:50
workaround for kivy gridlayout problem
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.app import Builder, App
from random import randint
from kivy.uix.stacklayout import StackLayout
from pygments.formatters import img
Builder.load_string("""
@Alan-FGR
Alan-FGR / yap.py
Created August 14, 2015 18:26
yet another problem with kivy
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.uix.stacklayout import StackLayout
from kivy.app import Builder, App
class MyApp(App):
def build(self):
lay1 = StackLayout(size_hint_y=None)
lay1.bind(minimum_height = lay1.setter("height"))
@Alan-FGR
Alan-FGR / omkp.py
Created August 14, 2015 19:30
One more kivy problem
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.uix.stacklayout import StackLayout
from kivy.app import Builder, App
class MyApp(App):
def build(self):
lay1 = StackLayout(size_hint_y=None)
lay1.bind(minimum_height = lay1.setter("height"))
@Alan-FGR
Alan-FGR / kwargs.py
Created June 17, 2016 03:03
SSCCE for IRC
class MyClass(object):
def method_a(self, **kwargs):
self.method_b('arg_x_value', **kwargs)
def method_b(self, arg_x, arg_y=None, **kwargs):
print arg_y
self.method_c(**kwargs)
def method_c(self, arg_z=None):
print arg_z
@Alan-FGR
Alan-FGR / MixinExample.py
Last active June 17, 2016 03:17
Correct Mixin Example
class Base(object):
def methodX(self):
print "methodX from Base"
def methodY(self):
print "methodY from Base"
class BaseDeriv(Base): #inherits methodX
def methodY(self): #overrides methodY
print "methodY BaseDeriv Override"
@Alan-FGR
Alan-FGR / dynamic_unit_kivy.py
Created June 18, 2016 22:26
Example of a new dynamic unit in kivy
from kivy.app import App
from kivy.app import Builder
from kivy.uix.stacklayout import StackLayout
from kivy.uix.button import Button
from kivy.properties import NumericProperty
Builder.load_string("""
<Button>:
size_hint: None, None
size: app.my_unit, app.my_unit*0.4
@Alan-FGR
Alan-FGR / PackingBits.cs
Last active July 8, 2023 04:16
Packing Bits in C#
using System;
class PackingBits
{
static void Main(string[] args)
{
// say you have this data:
byte byteA = 7;
byte byteB = 5;
ushort someNumber = 1500;