Skip to content

Commit

Permalink
Merge pull request #52 from Ry10p/master
Browse files Browse the repository at this point in the history
Added a Linux tutorial
  • Loading branch information
freakboy3742 committed Jul 6, 2017
2 parents 5e45795 + b4bf6f2 commit 1b13962
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/tutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ These tutorials are step-by step guides for using Briefcase.
:glob:

tutorial-0
tutorial-0-Linux
tutorial-1
84 changes: 84 additions & 0 deletions docs/tutorials/tutorial-0-Linux.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
Linux Tutorial 0 - Hello, world!
================================

In this tutorial, you'll take a really simple "Hello, world!" program written in
Python, convert it into a working Linux project.

Setup
-----

This tutorial assumes you've read and followed the instructions in
:doc:`/intro/getting-started`. This Tutorial is for Linux Users!
* A ``tutorial`` directory,
* An activated Python 3 virtual environment,
* Briefcase installed in that virtual environment,

Start a new project
-------------------

Let's get started by using `the handy template <https://github.com/pybee/briefcase-template>`_ ``briefcase-template``:

.. code-block:: bash
$ pip install cookiecutter briefcase
$ cookiecutter https://github.com/pybee/briefcase-template
This will ask a bunch of questions of you. We'll use an `app_name` of "tutorial_0", and a
`formal_name` of "Tutorial 0". Set the other values as you like

You'll now have a few files in this folder, including ``tutorial_0``.

Check out what the provided ``tutorial_0/app.py`` file contains:

.. code-block:: bash
(BeeWare)user$ cd tutorial_0
(BeeWare)user$ cat tutorial_0/app.py
.. code-block:: python
def main():
# This needs to return an object that has a main_loop() method.
return None
This won't do much as it is, but we can make it useful.

Add this into the ``app.py`` to make it useful:

.. code-block:: python
class MyApp:
def main_loop(self):
print("Hello world")
def main():
return MyApp()
Create an Linux project
-----------------------

It is all ready for using ``briefcase``. You can invoke it, using:

.. code-block:: bash
$ python setup.py linux
to create the Linux app.

Open the project
----------------

There is a new folder in your project called 'linux', which contains the project (tutorial_0). You can open the application by running:

.. code-block:: bash
./linux/tutorial_0
The app should run like this!
.. code-block:: bash
$ ./linux/tutorial_0
Hello World!
And that is all, you created your first Linux python app!

0 comments on commit 1b13962

Please sign in to comment.