-
-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from Ry10p/master
Added a Linux tutorial
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ These tutorials are step-by step guides for using Briefcase. | |
:glob: | ||
|
||
tutorial-0 | ||
tutorial-0-Linux | ||
tutorial-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |