~ubuntu-branches/debian/stretch/electrum/stretch

« back to all changes in this revision

Viewing changes to gui/kivy/tools/.buildozer/android/platform/python-for-android/dist/kivy/python-install/share/kivy-examples/guide/firstwidget/5_random_colors.py

  • Committer: Package Import Robot
  • Author(s): Tristan Seligmann
  • Date: 2016-04-04 03:02:39 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20160404030239-0szgkio8yryjv7c9
Tags: 2.6.3-1
* New upstream release.
  - Drop backported install-wizard-connect.patch.
* Add Suggests: python-zbar and update the installation hint to suggest
  apt-get instead of pip (closes: #819517).
* Bump Standards-Version to 3.9.7 (no changes).
* Update Vcs-* links.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from random import random
 
2
from kivy.app import App
 
3
from kivy.uix.widget import Widget
 
4
from kivy.graphics import Color, Ellipse, Line
 
5
 
 
6
 
 
7
class MyPaintWidget(Widget):
 
8
 
 
9
    def on_touch_down(self, touch):
 
10
        color = (random(), random(), random())
 
11
        with self.canvas:
 
12
            Color(*color)
 
13
            d = 30.
 
14
            Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))
 
15
            touch.ud['line'] = Line(points=(touch.x, touch.y))
 
16
 
 
17
    def on_touch_move(self, touch):
 
18
        touch.ud['line'].points += [touch.x, touch.y]
 
19
 
 
20
 
 
21
class MyPaintApp(App):
 
22
 
 
23
    def build(self):
 
24
        return MyPaintWidget()
 
25
 
 
26
 
 
27
if __name__ == '__main__':
 
28
    MyPaintApp().run()