logo资料库

Kivy - Interactive Applications and Games in Python(PACKT,2ed,2015)..pdf

第1页 / 共206页
第2页 / 共206页
第3页 / 共206页
第4页 / 共206页
第5页 / 共206页
第6页 / 共206页
第7页 / 共206页
第8页 / 共206页
资料共206页,剩余部分请下载后查看
Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: GUI Basics – Building an Interface
Basic interface – Hello World!
Basic widgets – labels and buttons
Layouts
Embedding layouts
PageLayout – swiping pages
Our project – Comic Creator
Summary
Chapter 2: Graphics – The Canvas
Understanding the canvas
Drawing basic shapes
Adding images, colors, and backgrounds
Structuring graphic instructions
Rotating, translating, and scaling the coordinate space
Comic Creator: PushMatrix and PopMatrix
Summary
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 its properties
Summary
Chapter 4: Improving the User Experience
ScreenManager – selecting colors for the figures
Color control on the canvas – coloring figures
StencilView – limiting the drawing space
Scatter – multi-touching to drag, rotate, and scale
Recording gestures – line, circle, and cross
Recognizing gestures – drawing with the finger
Behaviors – enhancing widgets functionality
Style – decorating the interface
Factory – replacing a vertex instruction
Summary
Chapter 5: Invaders Revenge – an Interactive Multi-touch Game
Invaders Revenge – an animated multi-touch game
Atlas – An 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 – multi-touch control
Invasion – moving the shooter with the keyboard
Combining animations with '+' and '&'
Summary
Chapter 6: Kivy Player – A TED Video Streamer
Video – play, pause, and stop
AsyncImage – creating a cover for the video
Subtitles – tracking the video progression
Control bar – adding buttons to control the video
Slider – including a progression bar
Animation – hiding a widget
Kivy inspector – debugging interfaces
ActionBar – a responsive bar
LoadDialog – displaying a directory of files
ScrollView – displaying a list of videos
Search – query the TED Developer API
Summary
Index
[ 1 ] www.it-ebooks.info
Kivy – Interactive Applications and Games in Python Second Edition Create responsive cross-platform UI/UX applications and games in Python using the open source Kivy library Roberto Ulloa BIRMINGHAM - MUMBAI www.it-ebooks.info
Kivy – Interactive Applications and Games in Python Second Edition Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: September 2013 Second edition: June 2015 Production reference: 1240615 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78528-692-6 www.packtpub.com www.it-ebooks.info
Credits Project Coordinator Suzanne Coutinho Proofreader Safis Editing Indexer Priya Sane Graphics Sheetal Aute Disha Haria Jason Monteiro Production Coordinator Nitesh Thakur Cover Work Nitesh Thakur Author Roberto Ulloa Reviewers Takumi Adachi Philip Bjorge Joe Dorocak Vijay Mahrra Edward C. Delaporte V Commissioning Editor Nadeem N. Bagban Acquisition Editor Nikhil Karkal Content Development Editor Amey Varangaonkar Technical Editor Ankur Ghiye Copy Editor Adithi Shetty www.it-ebooks.info
About the Author Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour. com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet. I would like to thank Celina for supporting me in all my adventures, in particular, this book. I am very grateful for the valuable contributions and feedback of the Packt Publishing team, the editors, and the reviewers. Also, I would like to thank all those people who made the previous edition possible. Their ideas and encouragement made that edition a success, which is why I have now been given the opportunity to update and expand it with this second edition. www.it-ebooks.info
About the Reviewers Takumi Adachi is an avid user and programmer of web and mobile applications. His strong points include HTML/CSS, JavaScript and its many frameworks and libraries, and Android development. He has also contributed a little to Kivy Blueprints, Mark Vasilkov, Packt Publishing. I want to thank my family, friends, Justin, and my past and present employers for helping me get to where I am today. Philip Bjorge is a full-stack developer who has worked on projects for health, amusement parks, academics, and high-tech industries. Prior to joining Substantial, a Seattle-based software design agency, he worked on the Xbox Music and Video team at Microsoft. Most notably, he was a developer for Surface Music Kit, an app that was featured at the Surface 2 press conference unveiling and was on display in Microsoft stores nationwide. www.it-ebooks.info
Joe Dorocak, whose Internet moniker is Joe Codeswell, is a very experienced programmer. He enjoys creating readable code that implements project requirements efficiently and in a manner that can be easily understood. He considers writing code akin to writing poetry. He crafts his code so it acts as communication, not only with the machine platforms on which it runs, but also with the human programmers who will read it in the future. Joe has been employed directly and also in a contractual role by start-ups and by many major top-shelf companies, including IBM, HP, and GTE/Sprint. Joe is presently concentrating on application and web project consulting using languages, frameworks, and tools and techniques, including Python, JavaScript, web2py, Cython, memoization, and other performance enhancement techniques. For more details on him, please visit https://www.linkedin.com/in/joedorocak. Joe has also worked on Kivy Blueprints by Mark Vasilko and Functional Programming in JavaScript by Dan Mantyla. I am very grateful to Suzanne Coutinho and Nidhi Joshi of Packt Publishing. They have always coordinated my efforts wisely, professionally, and with a consistent human touch. www.it-ebooks.info
Vijay Mahrra is an experienced system administrator, developer, and programmer with over 20 years of experience from the very early days of the Web to the present day, contributing his knowledge and experience to various free and open source projects along the way. You can find out more about him at http://about.me/vijay.mahrra A big thank you to my mother, Nirmal; niece, Shreya; and everyone at Packt Publishing. Thanks to Matt Saunders and Neil Levine for all the years of hosting. Edward C. Delaporte V has been creating and using software since the mid 1980s. Edward wants to thank all of the software developers who wrote the code he learned from, especially those who took the time to also write about their code, how to program, and how to program well. www.it-ebooks.info
分享到:
收藏