Skip to content

Instantly share code, notes, and snippets.

@quapka
quapka / kivy.py
Last active August 29, 2015 14:07
<MyScreenManager>:
orientation: 'vertical'
canvas.before:
Color:
rgba: 1,1,1,1
Rectangle:
pos: self.pos
size: self.size
MainMenuScreen:
FilmMenuScreen:
<MyScreenManager>:
MainMenuScreen:
<MainMenuScreen>:
name: 'MainMenuScreen'
ScrollView:
size_hint_x: None
width: root.width
effect_cls: 'ScrollEffect'
bar_width: 10
from kivy.app import App
from kivy.uix.label import Label
from kivy.animation import Animation
class DraggableLabel(Label):
'''A label you can drag upside-down'''
def on_touch_down(self, touch):
if self.collide_point(*touch.pos):
# assure ourselves we will get the updates of this motion
ScreenManager:
FirstScreen:
<FirstScreen>:
FloatLayout:
GridLayout:
cols: 1
canvas.before:
Color:
rgba: 1,0,1,.5
@quapka
quapka / score.py
Last active August 29, 2015 14:07
from kivy.app import App
from kivy.animation import Animation
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.graphics.vertex_instructions import Rectangle
from kivy.graphics.context_instructions import Color
from kivy.lang import Builder
from kivy.clock import ClockBase, Clock
from kivy.properties import ListProperty
[app]
# (str) Title of your application
title = My Application
# (str) Package name
package.name = myapp
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test
from kivy.app import App
__version__ = '1.0'
class MyApp(App):
pass
MyApp().run()
import urllib, cStringIO
import re
PATH = 'some path'
def download_file(path):
print "Attempting to download file from:"
print "URL: {}".format( path )
import requests
import json
data = json.dumps({'Name':'Jan'})
requests.post('http://www.math-in-python.com', data=data, headers={'Content-Type':'application/json'})
[app]
# (str) Title of your application
title = My Application
# (str) Package name
package.name = myapp
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test