Kivy: Interactive Applications in Python


Kivy: Interactive Applications in Python
eBook: $20.99
Formats: PDF, PacktLib, ePub and Mobi formats
$17.84
save 15%!
Print + free eBook + free PacktLib access to the book: $55.98    Print cover: $34.99
$34.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Use Kivy to implement apps and games in Python that run on multiple platforms
  • Discover how to build a User Interface (UI) through the Kivy Language
  • Glue the UI components with the logic of the applications through events and the powerful Kivy properties
  • Detect gestures, create animations, and schedule tasks
  • Control multi-touch events in order to improve the User Experience (UX)

Book Details

Language : English
Paperback : 138 pages [ 235mm x 191mm ]
Release Date : September 2013
ISBN : 1783281596
ISBN 13 : 9781783281596
Author(s) : Roberto Ulloa
Topics and Technologies : All Books, Mobile Application Development, Open Source

Table of Contents

Preface
Chapter 1: GUI Basics – Building an Interface
Chapter 2: Graphics – The Canvas
Chapter 3: Widget Events – Binding Actions
Chapter 4: Improving the User Experience
Chapter 5: Invaders Revenge – An Interactive Multitouch Game
Index
      • Chapter 3: Widget Events – Binding Actions
        • Attributes, id and root
        • Basic widget events – dragging the stickman
        • Localizing coordinates – adding stickmen
        • Binding and unbinding events – sizing limbs and heads
        • Binding events in the Kivy language
        • Creating your own events – the magical properties
        • Kivy and properties
        • Summary
        • Chapter 4: Improving the User Experience
          • Screen manager – selecting colors for the figures
          • Color Control on the canvas – coloring figures
          • StencilView – limiting the drawing space
          • Scatter – multitouching to drag, rotate, and scale
          • Recording gestures – line, circles, and cross
          • Simple gestures – drawing with the finger
          • Summary
          • Chapter 5: Invaders Revenge – An Interactive Multitouch Game
            • Invaders Revenge – an animated multitouch game
            • Atlas – efficient management of images
            • Boom – simple sound effects
            • Ammo – simple animation
            • Invader – transitions for animations
            • Dock – automatic binding in the Kivy language
            • Fleet – infinite concatenation of animations
            • Scheduling events with the Clock
            • Shooter – multitouch control
            • Invasion – moving the shooter with the keyboard
            • Combining animations with '+' and '&'
            • Summary

            Roberto Ulloa

            Roberto Ulloa has a diverse academic record in multiple disciplines within the field of Computer Science. He obtained an MSc from the University of Costa Rica and also taught programming and computer networking there. He then spent two years researching about cultural complexity at PhD level at the CulturePlex Lab of the University of Western Ontario. He loves travelling and enjoys an itinerant life, living among different cultures and environments. He loves nature and has spent many months volunteering in Central and South America. He currently lives in Kuala Lumpur, earning a living as a web developer in Python/Django and PHP/Wordpress. He constantly worries that the Internet has already become aware of itself and we are not able to communicate with it because of the improbability of it being able to speak Spanish or any of the 6,000 odd human languages that exist in this world. To know more about Roberto, you can visit http://robertour.com/
            Sorry, we don't have any reviews for this title yet.

            Code Downloads

            Download the code and support files for this book.


            Submit Errata

            Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


            Errata

            - 5 submitted: last submission 19 Dec 2013

            Errata type: Code |  Page number: 55 
            Line 46 of the code should read:
            # File name: comicwidgets.py
            instead of 
            # File name: comicwidgets.kv
            Errata type: Code |  Page number: 42 
            Line 136 of the code should read:
            136.    xyz:(5,.5,0)
            should be
            136.    xyz:(.5,.5,0)
            								

            Errata Type: Code | Page number:73

            The line 289 is as follows:

            msg_text: _msg_label.text

             

            It should be:

             

            msg_label: _msg_label

            Errata Type: Code related | Page number: 73

            The given information box is :

            In Python, the previous_counter(line 276) is a static attribute of the StatusBarclass. This means that it is shared among all the StatusBarinstances, and it can be accessed in any of the ways shown in lines 281, 283, and 285 (however line 281 is recommended). In contrast, the selected variable (line 248) is an attribute of a DraggableWidgetinstance. This means that there is a selectedvariable per StatusBarobject. It is not shared among them. They are created until the constructor (__init__) is called on. The only way to access it is through obj.selected(line 248)

             

            It should be :

             

            In Python, the previous_counter (line 276) is a static attribute of the StatusBar class. This means that it is shared among all the StatusBar instances, and it can be accessed in any of the ways shown in lines 281 and 283 (however line 281 is recommended because doesn't depend on the name of the class). In contrast, the selected variable (line 248) is an attribute of a DraggableWidget instance. This means that there is a selected variable per StatusBar object. It is not shared among them. They are created until the constructor (__init__) is called on. The only way to access it is through obj.selected (line 248).

            Errat type: Code | Page number:72

            The on_counter  method (lines 278 to 285) in the statusbar.py is as follows:

            def on_counter(self, instance, value):

             if value == 0:

             self.msg_text = "Drawing space cleared"

             elif value - 1 == self.__class__.previous_counter:

             self.msg_text = "Widget added"

             elif value + 1 == self.previous_counter:

            StatusBar.msg_text = "Widget removed"

             self.previous_counter = value

             

            It should be:

             

            def on_counter(self, instance, value):
                    if value == 0:
                        self.msg_label.text = "Drawing space cleared"
                    elif value - 1 == self.__class__.previous_counter:
                        self.msg_label.text = "Widget added"
                    elif value + 1 == StatusBar.previous_counter:
                        self.msg_label.text = "Widget removed"
                    self.__class__.previous_counter = value

            Sample chapters

            You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

            Frequently bought together

            Kivy: Interactive Applications in Python +    Building Machine Learning Systems with Python =
            50% Off
            the second eBook
            Price for both: £23.15

            Buy both these recommended eBooks together and get 50% off the cheapest eBook.

            What you will learn from this book

            • Build a User Interface (UI) using the Kivy Language
            • Understand and alter the order of execution of the drawing instructions
            • Use the powerful Kivy properties to keep the UI always updated with the last user interactions
            • Bind and unbind Kivy events to control widgets (UI components), touches, the mouse and keyboard, animations, and clock
            • Scale, rotate, and translate widgets
            • Control and switch between different screens
            • Develop and use your own single gestures
            • Create animations and combine them to bring widgets to life
            • Add different types of translations to the animations
            • Comprehend the main strategies to control the multi-touch events
            • Schedule single or repetitive tasks such as animations

            In Detail

            Mobiles and tablets have brought with them a dramatic change in the utility of applications. Compatibility has become essential, and this has increased the kind of interaction that users expect: gestures, multi-touches, animations, and magic pens. Kivy is an open source Python solution that covers these market needs with an easy-to-learn and rapid development approach. Kivy is growing fast and gaining attention as an alternative to the established developing platforms.

            Kivy: Interactive Applications in Python quickly introduces you to the Kivy development methodology. You will learn some examples of how to use many of the Kivy components, as well as understand how to integrate and combine them into big projects. This book serves as a reference guide and is organized in such a way that once finished, you will have already completed your first project.

            You will start by learning the Kivy Language for building User Interfaces (UI) and vector figures. We then proceed to the uses of Kivy events and properties to glue the UI with the application logic.

            You then go on to build an entire User Interface (UI) starting from a hand-made sketch. Furthermore, you will go on to understand how to use the canvas and drawing instructions to create different types of geometrical figures. Finally, you will be introduced to a big set of interactive and smooth features: transformations (scale, rotate, and translate), gestures, animations, scheduling tasks, and multi-touch elements.

            Kivy: Interactive Applications in Python expands your knowledge by introducing various components that improve the User Experience (UX). Towards the end of the book, you will be confident to utilize Kivy components and strategies to start any application or game you have in mind.

            Approach

            Kivy: Interactive Applications in Python is an easy-to-follow book that will guide you into the world of Kivy.

            Who this book is for

            This book is aimed at Python developers who are familiar with Python and have a good understanding of concepts like inheritance, classes, and instances. No previous experience of Kivy is required, though some knowledge of event handling, scheduling, and user interfaces, in general, would boost your learning.

            Code Download and Errata
            Packt Anytime, Anywhere
            Register Books
            Print Upgrades
            eBook Downloads
            Video Support
            Contact Us
            Awards Voting Nominations Previous Winners
            Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
            Resources
            Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software