Skip to content

Instantly share code, notes, and snippets.

View jegger's full-sized avatar

Dominique Burnand jegger

View GitHub Profile
@jegger
jegger / client.py
Created July 16, 2013 10:54
Infinitive loop with dbus and kivy (logging)
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.widget import Widget
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
class UI(Widget):
def __init__(self, **kwargs):
@jegger
jegger / expythonOS.py
Created July 16, 2013 15:33
OS-rendering with wxpython
# An example of embedding CEF browser in wxPython on Linux.
import ctypes, os, sys
libcef_so = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'libcef.so')
if os.path.exists(libcef_so):
# Import local module
ctypes.CDLL(libcef_so, ctypes.RTLD_GLOBAL)
if 0x02070000 <= sys.hexversion < 0x03000000:
import cefpython_py27 as cefpython
else:
from kivy.app import App
from kivy.graphics.fbo import Fbo
from kivy.uix.widget import Widget
from kivy.graphics import Color, Rectangle, GraphicException
from kivy.clock import Clock
from kivy.graphics.texture import Texture
from kivy.properties import ObjectProperty
####CEF IMPORT ####
####
@jegger
jegger / save.py
Created August 7, 2013 07:34
modified fbo example to show texture.save()
'''
FBO example
===========
This is an example of how to use FBO (Frame Buffer Object) to speedup graphics.
An Fbo is like a texture that you can draw on it.
By default, all the children are added in the canvas of the parent.
When you are displaying thousand of widget, you'll do thousands of graphics
instructions each frame.
@jegger
jegger / cefp_scroll_sniped.py
Created October 12, 2013 07:41
on_touch_* functions overwritten for scrolling (two fingers)
def on_touch_down(self, touch, *kwargs):
if not self.collide_point(*touch.pos):
return
touch.grab(self)
self.touches.append(touch)
touch.is_dragging = False
touch.is_scrolling = False
if len(self.touches)==1:
@jegger
jegger / Kivy_on_Mac_10.9.2
Last active May 22, 2024 00:37
Install kivy into a virtualenv on Mac 10.9 Mavericks
# Inspired by:
# - https://gist.github.com/goldsmith/7262122
# - https://gist.github.com/brousch/6589386
#### Some hints ####
# Currently kivy apps only work on monitor 1 (multiple monitor setup)
# You have to place the terminal which runs kivy on the monitor 1 or make the app fullscreen.
# Make sure you have the "command line tools" for mavericks installed!
# (xcode-select --install)
@jegger
jegger / Pygst_virtualenv.sh
Created April 6, 2014 09:51
Install (link) gstreamer0.10 (pygst / gst) into a virtualenv
# Replace 'venv' with the foldername of your virtualenv.
# This script links the gst module and it's dependecies into the virtualenv.
# Tested on ubuntu 12.04
sudo apt-get install python-gst0.10
cd venv/lib/python2.7/site-packages
ln -s /usr/lib/python2.7/dist-packages/glib
ln -s /usr/lib/python2.7/dist-packages/gobject
ln -s /usr/lib/python2.7/dist-packages/gst-0.10
ln -s /usr/lib/python2.7/dist-packages/gstoption.so
@jegger
jegger / timer.py
Last active January 21, 2021 19:56
A simple kivy timer (set minutes via command line args)
from kivy.config import Config
Config.set('graphics', 'width', '700')
Config.set('graphics', 'height', '200')
Config.write()
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.lang import Builder
from kivy.properties import BooleanProperty, StringProperty
from kivy.clock import Clock
@jegger
jegger / ignorer.py
Created November 21, 2014 09:28
OSC TUIO forwarder / multiplexer / touch ignorer
from OSC import OSCServer
from OSC import OSCClient
from OSC import OSCMessage
import time
import Queue
import threading
server = OSCServer(("localhost", 3333))
@jegger
jegger / main.py
Created March 22, 2015 16:21
WAMP autobahn reconnect
# Copied from https://gist.github.com/DenJohX/e6d0864738da10cb9685 -> DenJohX
# Slightly modified
import sys
from twisted.python import log
from twisted.internet import reactor
from twisted.internet.protocol import ReconnectingClientFactory
from autobahn.websocket.protocol import parseWsUrl
from autobahn.twisted import wamp, websocket