kivy/doc/sources/gettingstarted/examples.rst

279 lines
13 KiB
ReStructuredText
Raw Normal View History

Examples
--------
2014-06-09 19:20:52 +00:00
.. container:: title
Follow through the examples.
.. |ani_dir| replace:: ./examples/animation
.. |ani_file| replace:: animate.py
.. |ani_desc| replace:: Widget animation using
:class:`Animation <kivy.animation.Animation>`
.. |app_dir| replace:: ./examples/application
.. |app_file1| replace:: app_with_build.py
.. |app_desc1| replace:: Application example using
:py:meth:`~kivy.app.App.build`
.. |app_file2| replace:: app_with_kv.py
.. |app_desc2| replace:: Application from a :mod:`.kv <kivy.lang>` file
.. |app_file3| replace:: app_with_kv_in_template1.py
.. |app_desc3| replace:: Application from a :mod:`kv_directory <kivy.lang>`
.. |aud_dir| replace:: ./examples/audio:
.. |aud_file| replace:: main.py
.. |aud_desc| replace:: How to play :mod:`Audio <kivy.core.audio>`.
.. |can_dir| replace:: ./examples/canvas
.. |can_file1| replace:: bezier.py
.. |can_desc1| replace:: How to draw
:class:`Bezier <kivy.graphics.Bezier>` Lines
.. |can_file2| replace:: canvas_stress.py
.. |can_desc2| replace:: Stress test :class:`Canvas <kivy.graphics.Canvas>`
.. |can_file3| replace:: mesh.py
2014-06-08 09:21:31 +00:00
.. |can_desc3| replace:: How to use the
:class:`Mesh <kivy.graphics.Mesh>` in kivy
.. |can_file4| replace:: multitexture.py
.. |can_desc4| replace:: How to handle multiple textures with a
:class:`Shader <kivy.graphics.shader.Shader>`
.. |can_file5| replace:: stencil_canvas.py
2014-06-08 09:21:31 +00:00
.. |can_desc5| replace:: How to use the
:mod:`Stencil <kivy.graphics.stencil_instructions>`
on the widget canvas
.. |dem_dir| replace:: ./examples/demo:
.. |dem_file| replace:: camera_puzzle.py
2014-06-08 09:21:31 +00:00
.. |dem_desc| replace:: A puzzle using the
:class:`Camera <kivy.uix.camera.Camera>` output
.. |pic_dir| replace:: ./examples/demo/pictures
.. |pic_file| replace:: main.py
2014-06-08 09:21:31 +00:00
.. |pic_desc| replace:: Highlights usage of the
:class:`Image <kivy.uix.image>` and
:class:`Scatter <kivy.uix.scatter>` Widgets
.. |sed_dir| replace:: ./examples/demo/shadereditor
.. |sed_file| replace:: main.py
2014-06-08 09:21:31 +00:00
.. |sed_desc| replace:: How to use the
:class:`fragment and vertex shaders
<kivy.graphics.shader.Shader>`.
.. |sho_dir| replace:: ../examples/demo/showcase
.. |sho_file| replace:: main.py
.. |sho_desc| replace:: Showcase of the
:class:`widgets <kivy.uix.widget.Widget>` and
:mod:`layouts <kivy.uix.layout>` available in kivy
.. |tch_dir| replace:: ./examples/demo/touchtracer
.. |tch_file| replace:: main.py
.. |tch_desc| replace:: Draw lines under every detected touch
.. |tch_desc2| replace:: A good place to understand how
:mod:`touch events <kivy.input.motionevent>`
work in kivy
.. |tws_dir| replace:: ./examples/frameworks/twisted
.. |tws_file| replace:: echo_client_app.py
.. |tws_file2| replace:: echo_server_app.py
.. |tws_desc| replace:: A client and server app using
:doc:`Twisted inside Kivy </guide/other-frameworks>`
.. |gst_dir| replace:: ./examples/gestures
.. |gst_file| replace:: gesture_board.py
.. |gst_desc| replace:: A clean board to try out
:mod:`gestures <kivy.gesture>`
.. |kv_dir| replace:: ./examples/guide/designwithkv
.. |kv_file| replace:: main.py
.. |kv_desc| replace:: Programming Guide examples on how to :doc:`design with
kv lang </guide/lang>`
.. |fwd_dir| replace:: ./examples/tutorials/firstwidget
.. |fwd_file| replace:: 1_skeleton.py
.. |fwd_file2| replace:: 2_print_touch.py
.. |fwd_file3| replace:: 3_draw_ellipse.py
.. |fwd_file4| replace:: 4_draw_line.py
.. |fwd_file5| replace:: 5_random_colors.py
.. |fwd_file6| replace:: 6_button.py
.. |fwd_desc| replace:: Programming Guide example: :doc:`Your first
widget </tutorials/firstwidget>`
.. |qst_dir| replace:: ./examples/guide/quickstart
.. |qst_file| replace:: main.py
.. |qst_desc| replace:: Programming Guide example:
:doc:`Create an application </guide/basic>`
2014-06-10 06:26:01 +00:00
.. _kinect: http://en.wikipedia.org/wiki/kinect
.. |kin_dir| replace:: ./examples/kinect
.. |kin_file| replace:: main.py
2014-06-10 06:26:01 +00:00
.. |kin_desc| replace:: How to use the `kinect`_ for input
.. |kvd_dir| replace:: ./examples/kv
.. |kvd_file| replace:: kvrun.py
.. |kvd_desc| replace:: Load kv files, use
:mod:`kv lang <kivy.lang>`
to load different
:class:`widgets <kivy.uix.widget.Widget>`.
.. |rst_dir| replace:: ./examples/RST_Editor
.. |rst_file| replace:: main.py
.. |rst_desc| replace:: An RST editor for the
:class:`RstDocument <kivy.uix.rst.RstDocument>` Widget
.. |sdr_dir| replace:: ./examples/shader
.. |sdr_file| replace:: plasma.py
.. |sdr_file1| replace:: shadertree.py
.. |sdr_desc| replace:: How to use different
:class:`Shaders <kivy.graphics.shader.Shader>`.
.. |png_dir| replace:: ./examples/tutorials/pong
.. |png_file| replace:: main.py
.. |png_desc| replace:: :doc:`/tutorials/pong`. Your first step in kivy
programming
.. |wdg_dir| replace:: ./examples/widgets
.. |wdg_file1| replace:: accordion_1.py
.. |wdg_desc1| replace:: Usage and showcase of
:class:`Accordion <kivy.uix.accordion>` Widget
.. |wdg_file2| replace:: asyncimage.py
.. |wdg_desc2| replace:: Usage and showcase of
:class:`AsyncImage <kivy.uix.image.AsyncImage>` Widget
.. |wdg_file25| replace:: boxlayout_pos_hint.py
.. |wdg_desc25| replace:: Showcase of pos_hint under
:class:`BoxLayout <kivy.uix.boxlayout>`
.. |wdg_file3| replace:: bubble_test.py
.. |wdg_desc3| replace:: Usage and Showcase of :class:`Bubble <kivy.uix.bubble>`
Widget
.. |wdg_file4| replace:: customcollide.py
.. |wdg_desc4| replace:: Test for
:attr:`collision <kivy.uix.widget.Widget.collide_point>`
with custom shaped widget
.. |wdg_file5| replace:: fbowidget.py
.. |wdg_desc5| replace:: Usage of :class:`FBO <kivy.graphics.fbo>` to speed up
graphics
.. |wdg_file6| replace:: image_mipmap.py
.. |wdg_desc6| replace:: How to use :class:`Image <kivy.uix.image>` widget with
mipmap
.. |wdg_file7| replace:: keyboardlistener.py
.. |wdg_desc7| replace:: Listen to the keyboard input and spew result to console
.. |wdg_file8| replace:: label_mipmap.py
.. |wdg_desc8| replace:: How to use :class:`Label <kivy.uix.label>` widget with
.. |wdg_file81| replace:: label_with_markup.py
.. |wdg_desc81| replace:: Usage of :class:`Label <kivy.uix.label>` widget with
markup
.. |wdg_file82| replace:: popup_with_kv.py
.. |wdg_desc82| replace:: Usage of
:class:`Popup <kivy.uix.popup>` widget with ``kv``
language
.. |wdg_file9| replace:: rstexample.py
.. |wdg_desc9| replace:: Usage and showcase of
:class:`RstDocument <kivy.uix.rst.RstDocument>` Widget
.. |wdg_file10| replace:: scatter.py
.. |wdg_desc10| replace:: Usage and showcase of
:class:`Scatter <kivy.uix.scatter>` Widget
.. |wdg_file11| replace:: screenmanager.py
.. |wdg_desc11| replace:: Usage and showcase of
:mod:`ScreenManager <kivy.uix.screenmanager>` Module
.. |wdg_file12| replace:: scrollview.py
.. |wdg_desc12| replace:: Usage and showcase of
:class:`ScrollView <kivy.uix.scrollview>` Widget
.. |wdg_file14| replace:: spinner.py
.. |wdg_desc14| replace:: Usage and showcase of
:class:`Spinner <kivy.uix.spinner>` Widget
.. |wdg_file15| replace:: tabbedpanel.py
.. |wdg_desc15| replace:: Usage of a simple
:class:`TabbedPanel <kivy.uix.tabbedpanel.TabbedPanel>`
.. |wdg_file16| replace:: tabbed_panel_showcase.py
.. |wdg_desc16| replace:: Advanced showcase of
:class:`TabbedPanel <kivy.uix.tabbedpanel.TabbedPanel>`
.. |wdg_file17| replace:: textalign.py
.. |wdg_desc17| replace:: Usage of text alignment in
:class:`Label <kivy.uix.label>` widget
.. |wdg_file18| replace:: textinput.py
.. |wdg_desc18| replace:: Usage and Showcase of
:class:`TextInput <kivy.uix.textinput>` Widget
.. |wdg_file19| replace:: unicode_textinput.py
.. |wdg_desc19| replace:: Showcase of unicode text in
:class:`TextInput <kivy.uix.textinput>` Widget
.. |wdg_file20| replace:: videoplayer.py
.. |wdg_desc20| replace:: Usage and options of
:class:`VideoPlayer <kivy.uix.videoplayer>` Widget
.. |seq_dir| replace:: ./examples/widgets/sequenced_images:
.. |seq_file| replace:: main.py
.. _gifs: http://en.wikipedia.org/wiki/Graphics_Interchange_Format
.. |seq_desc| replace:: Showcase usage of sequenced images using
`gifs`_ and images in .zip file
+------------+---------------+------------------------+
| Directory | Filename/s | Example Description |
+============+===============+========================+
|- |ani_dir| | - |ani_file| |- |ani_desc| |
+------------+---------------+------------------------+
|- |app_dir| | - |app_file1| |- |app_desc1| |
| | - |app_file2| |- |app_desc2| |
| | - |app_file3| |- |app_desc3| |
+------------+---------------+------------------------+
|- |can_dir| | - |can_file1| |- |can_desc1| |
| | - |can_file2| |- |can_desc2| |
| | - |can_file3| |- |can_desc3| |
| | - |can_file4| |- |can_desc4| |
| | - |can_file5| |- |can_desc5| |
+------------+---------------+------------------------+
|- |dem_dir| | - |dem_file| |- |dem_desc| |
+------------+---------------+------------------------+
|- |pic_dir| | - |pic_file| |- |pic_desc| |
+------------+---------------+------------------------+
|- |sed_dir| | - |sed_file| |- |sed_desc| |
+------------+---------------+------------------------+
|- |sho_dir| | - |sho_file| |- |sho_desc| |
+------------+---------------+------------------------+
|- |tch_dir| | - |tch_file| |- |tch_desc| |
| | |- |tch_desc2| |
+------------+---------------+------------------------+
|- |tws_dir| | - |tws_file| |- |tws_desc| |
| | - |tws_file2| | |
+------------+---------------+------------------------+
|- |gst_dir| | - |gst_file| |- |gst_desc| |
+------------+---------------+------------------------+
|- |kv_dir| | - |kv_file| |- |kv_desc| |
+------------+---------------+------------------------+
|- |fwd_dir| | - |fwd_file| |- |fwd_desc| |
| | - |fwd_file2| | |
| | - |fwd_file3| | |
| | - |fwd_file4| | |
| | - |fwd_file5| | |
| | - |fwd_file6| | |
+------------+---------------+------------------------+
|- |qst_dir| | - |qst_file| |- |qst_desc| |
+------------+---------------+------------------------+
|- |kin_dir| | - |kin_file| |- |kin_desc| |
+------------+---------------+------------------------+
|- |kvd_dir| | - |kvd_file| |- |kvd_desc| |
+------------+---------------+------------------------+
|- |rst_dir| | - |rst_file| |- |rst_desc| |
+------------+---------------+------------------------+
|- |sdr_dir| | - |sdr_file| |- |sdr_desc| |
| | - |sdr_file1| | |
+------------+---------------+------------------------+
|- |wdg_dir| | - |wdg_file1| |- |wdg_desc1| |
| | - |wdg_file2| |- |wdg_desc2| |
| | - |wdg_file25||- |wdg_desc25| |
| | - |wdg_file3| |- |wdg_desc3| |
| | - |wdg_file4| |- |wdg_desc4| |
| | - |wdg_file5| |- |wdg_desc5| |
| | - |wdg_file6| |- |wdg_desc6| |
| | - |wdg_file7| |- |wdg_desc7| |
| | - |wdg_file8| |- |wdg_desc8| |
| | - |wdg_file81||- |wdg_desc81| |
| | - |wdg_file82||- |wdg_desc82| |
| | - |wdg_file9| |- |wdg_desc9| |
| | - |wdg_file10||- |wdg_desc10| |
| | - |wdg_file11||- |wdg_desc11| |
| | - |wdg_file12||- |wdg_desc12| |
| | - |wdg_file14||- |wdg_desc14| |
| | - |wdg_file15||- |wdg_desc15| |
| | - |wdg_file16||- |wdg_desc16| |
| | - |wdg_file17||- |wdg_desc17| |
| | - |wdg_file18||- |wdg_desc18| |
| | - |wdg_file19||- |wdg_desc19| |
| | - |wdg_file20||- |wdg_desc20| |
+------------+---------------+------------------------+
|- |seq_dir| | - |seq_file| |- |seq_desc| |
+------------+---------------+------------------------+