- Kivy:Interactive Applications in Python
- Roberto Ulloa
- 362字
- 2021-08-04 10:03:15
Chapter 1. GUI Basics – Building an Interface
Kivy emerges as a successor of PyMT (a library for multitouch applications) with a simple but ambitious goal in mind — same code for every commonplace platform: Linux / Windows / Mac OS X / Macosx / Android / iOS (Mathieu Virbel, http://txzone.net/2011/01/kivy-next-pymt-on-android-step-1-done/). This support is being extended to Raspberry Pi thanks to a founding campaign started by Mathieu Virbel, the creator of Kivy. Kivy was introduced in the EuroPython 2011, as a Python framework designed for creating natural user interfaces.
So, let's start creating user interfaces using one of its fun and powerful components, the Kivy language (.kv
). The Kivy language helps us to separate the logic from the presentation. This is a fundamental engineering concept that helps to keep an easy and intuitive code. Nonetheless, it is possible to build a Kivy application using pure Python and Kivy as a library. We will also learn those concepts in later chapters because they allow us to modify interfaces dynamically.
This chapter covers all the basics for building a graphical user interface (GUI) in Kivy. Afterwards, you will be able to build practically any GUI you have in your mind, and even make them responsive to the size of window! The following is a list of all the skills that you're about to learn:
- Launching a Kivy application
- The Kivy language
- Creating and using widgets (GUI components)
- Basic properties and variables of the widgets
- Fixed, proportional, absolute, and relative coordinates
- Organizing GUIs through layouts
- Tips for achieving responsive GUIs
Apart from Python, this chapter requires some knowledge about Object-Oriented Programming (http://en.wikipedia.org/wiki/Object-oriented_programming) concepts. In particular, inheritance (http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)) and the difference between instances (http://en.wikipedia.org/wiki/Instance_(computer_science)) and classes (http://en.wikipedia.org/wiki/Class_(computer_science)) will be assumed. Before starting, you will need to install Kivy (The instructions can be found in http://kivy.org/docs/installation/installation.html). The book examples were tested on Kivy 1.7.0 but a more recent version should work as well.
At the end of this chapter, we will be able to build a GUI starting from a pencil and paper sketch. We will introduce the main project of the book — the Comic Creator, and implement the main structure of the GUI.
- C++面向對象程序設計(第三版)
- Unreal Engine Physics Essentials
- C#程序設計實訓指導書
- Python高級編程
- Reactive Programming With Java 9
- 精通Python自然語言處理
- Python算法指南:程序員經典算法分析與實現
- Flowable流程引擎實戰
- Python 3.7從入門到精通(視頻教學版)
- UI設計全書(全彩)
- uni-app跨平臺開發與應用從入門到實踐
- 大學計算機基礎實驗指導
- 從Excel到Python數據分析:Pandas、xlwings、openpyxl、Matplotlib的交互與應用
- 官方 Scratch 3.0 編程趣味卡:讓孩子們愛上編程(全彩)
- Python數據可視化之matplotlib實踐