Skip to content

Instantly share code, notes, and snippets.

View rogererens's full-sized avatar

Roger Erens rogererens

  • Eindhoven Area, NL
  • 18:41 (UTC +02:00)
View GitHub Profile
@rogererens
rogererens / main.py
Created May 11, 2015 20:11
Adding widgets based on settings
from kivy.app import App
from kivy.factory import Factory
from kivy.lang import Builder
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
Builder.load_string('''
<MilkshakeRoot>:
milkshakes: box_with_milkshakes
orientation: 'vertical'
/Applications/Kivy.app/Contents/Resources/script /Users/roger/Library/Preferences/PyCharm40/scratches/scratch
2015-04-14 21:48:40+0200 [-] Log opened.
2015-04-14 21:48:40+0200 [-] Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0x1013e6590>
2015-04-14 21:48:40+0200 [Uninitialized]
[('debug', True, 'WampWebSocketClientFactory'),
('debugCodePaths', False, 'WampWebSocketClientFactory'),
('logOctets', True, 'WampWebSocketClientFactory'),
('logFrames', True, 'WampWebSocketClientFactory'),
('trackTimings', False, 'WampWebSocketClientFactory'),
('allowHixie76', False, 'WampWebSocketClientFactory'),
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
class Component(ApplicationSession):
@inlineCallbacks
def onJoin(self, details):
print('session attached')
@rogererens
rogererens / client_kivy.py
Created October 2, 2014 21:54
A Kivy client for the AutobahnPython WebSocket Echo server (Twisted-based)
# As the Kivy docs ( http://kivy.org/docs/guide/other-frameworks.html ) state:
# install_twisted_rector must be called before importing and using the reactor.
from kivy.support import install_twisted_reactor
install_twisted_reactor()
from autobahn.twisted.websocket import WebSocketClientProtocol, \
WebSocketClientFactory
class MyKivyClientProtocol(WebSocketClientProtocol):