Skip to content

Commit 77336e8

Browse files
committed
Started on HowTo
1 parent fb63171 commit 77336e8

17 files changed

+318
-14
lines changed

en/about.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
i18n: en
55
---
66
<h1>About Mu</h1>
7-
<p class="lead">Mu is a Python code editor for beginner programmers and based
8-
upon <a href="/en/discuss">feedback</a> given by teachers and learners.</p>
7+
<p class="lead">Mu is a Python code editor for beginner programmers based
8+
on extensive <a href="/en/discuss">feedback</a> given by teachers and learners.</p>
99

1010
<div class="row text-center">
1111
<a class="btn btn-lg btn-success" href="/en/download" role="button">Download</a>

en/howto/copy_files_microbit.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
layout: default
3+
title: How to copy files on and off a micro:bit
4+
i18n: en
5+
---
6+
# How to Copy Files On and Off a micro:bit
7+
8+
MicroPython on the BBC micro:bit has [a very small filesystem](https://microbit-micropython.readthedocs.io/en/latest/tutorials/storage.html).
9+
Often you'll want to copy small files onto the device, or copy them from the
10+
micro:bit onto your own computer for further processing.
11+
12+
Happily, Mu has a visual way to do this by dragging and dropping files. Click
13+
on the button shown below:
14+
15+
<div class="row">
16+
<img src="/img/en/howto/microbit_files.png" alt="Files button" class="img-responsive center-block img-rounded movie"/>
17+
</div>
18+
19+
The pane shown below will appear at the bottom of Mu's window. Simply click and
20+
drag a file between the list of files on the micro:bit and those on your
21+
computer (as the animation shows). The files on your computer can be found in
22+
the folder Mu uses as your working directory (see the tutorial called
23+
[where are my files?](/en/tutorials/1.0/files)).
24+
25+
<div class="row">
26+
<img src="/img/en/howto/microbit_files.gif" alt="Moving files with a micro:bit" class="img-responsive center-block img-rounded movie"/>
27+
<br/>
28+
</div>
29+
30+
<div class="panel panel-danger">
31+
<div class="panel-heading"><h3 class="panel-title">
32+
<strong>WARNING:</strong> Don't toggle files off while the micro:bit is
33+
busy!</h3></div>
34+
<div class="panel-body"><p>If you click the "Files" button while the
35+
micro:bit is still reacting to instructions from Mu (such as listing files,
36+
getting the content of a file, and so on), then you may find that
37+
afterwards the REPL behaves strangely.</p>
38+
<p>The solution is simply to press restart on the device while the "Files"
39+
or "REPL" panes are off.</p>
40+
<p>If in doubt while using the "Files" pane, just wait for Mu to confirm
41+
that whatever file related activity is happening, is reported as finished
42+
(as shown above).</p>
43+
</div>
44+
</div>

en/howto/create_load_save.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
layout: default
3+
title: How to create, load and save files in Mu.
4+
i18n: en
5+
---
6+
# How to create, load and save files in Mu
7+
8+
You need to understand what each of the following three buttons do:
9+
10+
<div class="row">
11+
<img src="/img/en/howto/create_load_save.png" alt="New, Load and Save buttons" class="img-responsive center-block img-rounded movie"/>
12+
</div>
13+
14+
* **New** - Click on this button to create a new empty file. Before you can run
15+
your code you'll need to save it (i.e. give it a filename).
16+
* **Load** - When you click this button a file selector dialog box pops up and
17+
you should click on the Python file you'd like to load into Mu (or press
18+
cancel).
19+
* **Save** - Clicking this button saves the file in the currently selected tab.
20+
If the file was newly created then Mu will ask you for a name for the file.
21+
22+
<div class="panel panel-info">
23+
<div class="panel-heading"><h3 class="panel-title">Copy/Rename Files</h3></div>
24+
<div class="panel-body">
25+
<p>If you want to create a newly named copy of the current file you
26+
can rename it by clicking on the filename in the file's tab in Mu.</p>
27+
</div>
28+
</div>
29+
30+
<div class="panel panel-danger">
31+
<div class="panel-heading"><h3 class="panel-title">Don't Use Python Module Names</h3></div>
32+
<div class="panel-body">
33+
<p>It's tempting to name your new file that uses the <code>turtle</code>
34+
module as "turtle.py". <strong>Don't do this!</strong> If you name
35+
your file after a module you're using <strong>in your code</strong>
36+
then Python will break because it's trying to import
37+
<strong>your</strong> code rather than the code from Python's standard
38+
library!</p>
39+
</div>
40+
</div>

en/howto/index.html

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,19 @@ <h1>How-to Guides</h1>
1212
<h2>Installation</h2>
1313

1414
<ul>
15-
<li>How to install Mu with Python packaging on Windows, OSX and Linux.</li>
16-
<li>How to install Mu on a Raspberry Pi.</li>
17-
<li>How to install Mu on Windows with the official installer.</li>
18-
<li>How to install Mu on OSX with homebrew.</li>
19-
<li>How to install Mu on a Debian based Linux (e.g. Raspbian).</li>
20-
<li>How to install Mu on a Fedora based Linux.</li>
15+
<li><a href="install_windows">How to install Mu on Windows with the official installer</a>.</li>
16+
<li><a href="install_with_python">How to install Mu with Python packaging on Windows, OSX and Linux</a>.</li>
17+
<li><a href="install_raspberry_pi">How to install Mu on a Raspberry Pi</a>.</li>
2118
</ul>
2219

2320
<h2>Using Mu</h2>
2421

2522
<ul>
26-
<li>How to create, load and save files in Mu.</li>
27-
<li>How to change modes in Mu.</li>
28-
<li>How to read the logs in Mu.</li>
29-
<li>How to use the REPL in Python 3.</li>
30-
<li>How to use the plotter.</li>
31-
<li>How to copy files on and off a micro:bit.</li>
23+
<li><a href="create_load_save">How to create, load and save files in Mu</a>.</li>
24+
<li><a href="read_logs">How to read the logs in Mu</a>.</li>
25+
<li><a href="copy_files_microbit">How to copy files on and off a micro:bit</a>.</li>
26+
<li>How to configure Python3 to work with GPIOZero.</li>
27+
<li>How to minify your MicroPython scripts for the micro:bit.</li>
3228
<li>How to add new sounds and images to Pygame Zero.</li>
3329
</ul>
3430

en/howto/install_raspberry_pi.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: default
3+
title: How to install Mu on a Raspberry Pi
4+
i18n: en
5+
---
6+
7+
# How to install Mu on a Raspberry Pi
8+
9+
If you're using the Raspberry Pi Foundation's official
10+
[Raspbian](https://www.raspberrypi.org/downloads/raspbian/)
11+
operating system you should use your preferred package management application
12+
and install `mu-editor`.
13+
14+
If you're familiar with a terminal it's as simple as typing:
15+
16+
```
17+
apt-get install mu-editor
18+
```
19+
20+
Mu should be accessible from the desktop's menu.

en/howto/install_windows.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
layout: default
3+
title: How to install Mu on Windows with the Official Installer
4+
i18n: en
5+
---
6+
7+
# How to install Mu on Windows with the Official Installer
8+
9+
Since most of our users will be using Mu on Windows in an educational setting
10+
we've made it extraordinarily easy to install Mu on Windows. We've checked
11+
Mu works on Windows 7 (32bit) and Windows 10 (64bit) - so it should work on
12+
all the versions of Windows in between.
13+
14+
First, follow the
15+
[advice on Microsoft's website](https://support.microsoft.com/en-us/help/15056/windows-7-32-64-bit-faq) to work out if you're using 32 or 64 bit Windows.
16+
17+
Next, [download the correct installer](/en/download) for your version of
18+
Windows (either 32 or 64 bit for Windows 7 or above). The installer itself is
19+
an executable so you need to run it to make it work.
20+
21+
Follow the steps illustrated below and, once installation has finished, you'll
22+
find Mu in your start menu.
23+
24+
<div class="row">
25+
<h2>Step 1</h2>
26+
<p>Confirmation of the version of Mu you'll be installing. The version
27+
number will likely be different from the one shown below.</p>
28+
<img src="/img/en/howto/winstall1.png" alt="Windows installer step 1" class="img-responsive center-block img-rounded movie"/>
29+
</div>
30+
<div class="row">
31+
<h2>Step 2</h2>
32+
<p>You need to agree to <a href="https://github.com/mu-editor/mu/blob/master/LICENSE">Mu's license</a> before installing the software.</p>
33+
<img src="/img/en/howto/winstall2.png" alt="Windows installer step 2" class="img-responsive center-block img-rounded movie"/>
34+
</div>
35+
<div class="row">
36+
<h2>Step 3</h2>
37+
<p>Select if you want to install Mu for all users, or just yourself.</p>
38+
<img src="/img/en/howto/winstall3.png" alt="Windows installer step 3" class="img-responsive center-block img-rounded movie"/>
39+
</div>
40+
<div class="row">
41+
<h2>Step 4</h2>
42+
<p>Select the installation destination (you can usually safely ignore this
43+
step).</p>
44+
<img src="/img/en/howto/winstall4.png" alt="Windows installer step 4" class="img-responsive center-block img-rounded movie"/>
45+
</div>
46+
<div class="row">
47+
<h2>Step 5</h2>
48+
<p>Go make a cup of coffee as Mu installs on your machine.</p>
49+
<img src="/img/en/howto/winstall5.png" alt="Windows installer step 5" class="img-responsive center-block img-rounded movie"/>
50+
</div>
51+
<div class="row">
52+
<h2>Step 6</h2>
53+
<p>Confirmation that Mu has installed properly.</p>
54+
<img src="/img/en/howto/winstall6.png" alt="Windows installer step 6" class="img-responsive center-block img-rounded movie"/>
55+
</div>

en/howto/install_with_python.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
layout: default
3+
title: How to install Mu with Python packaging on Windows, OSX and Linux.
4+
i18n: en
5+
---
6+
# How to install Mu with Python packaging on Windows, OSX and Linux
7+
8+
If you already have [Python3](https://python.org/) installed on your Windows,
9+
OSX or Linux machine then the easiest way to install Mu is with Python's
10+
built-in package manager, [`pip`](https://pip.pypa.io/en/stable/installing/).
11+
If you're on Windows and would rather not type commands you should use the
12+
[Windows installer for Mu](install_windows) instead.
13+
14+
At your OS's command prompt (see below) type the following command:
15+
16+
```
17+
pip3 install mu-editor
18+
```
19+
20+
You'll see a bunch of things downloading from the internet. These are the other
21+
Python libraries Mu needs to work. If it's worked the final message from `pip`
22+
will be something like, "Successfully installed..." followed by a list of all
23+
the packages upon which Mu depends.
24+
25+
To run Mu, still in the command prompt, type:
26+
27+
```
28+
mu-editor
29+
```
30+
31+
Press return and the editor should launch.
32+
33+
<div class="panel panel-danger">
34+
<div class="panel-heading"><strong>Warning</strong></div>
35+
<div class="panel-body"><p>Depending on how <strong>your</strong> machine
36+
is set up, you may encounter errors. The most common are:</p>
37+
<ul>
38+
<li>You don't have permission to use <code>pip</code> to install
39+
packages, in which case, talk to whoever administers your computer and
40+
ask them to install Mu for you (just point them to this website).</li>
41+
<li>You're using the wrong or and old version of <code>pip</code>. If
42+
you have Python 2 installed on your machine, you <strong>must</strong>
43+
make sure you're using <code>pip3</code>. If <code>pip</code> complains
44+
it is out of date, follow these
45+
<a href="https://pip.pypa.io/en/stable/installing/">instructions for
46+
updating pip</a>.</li>
47+
<li>You can't even run <code>pip</code>, in which case check you have
48+
Python 3 installed and that when Python was installed, you clicked the
49+
option that asks you if you'd like Python added to your path (you
50+
do).</li>
51+
</ul>
52+
<p>If you're still facing problems, perhaps try using another installation
53+
method (HINT: if you're on Windows, use the Windows installer instead).
54+
As a last resort why not see if anyone can help you in the
55+
<a href="/en/discuss">discussions</a>.</p>
56+
</div>
57+
</div>
58+
59+
## What is a Command Prompt?
60+
61+
Most people use a graphical user interface (GUI) on their computer: basically,
62+
windows and icons controlled with a mouse and pointer. However, it's also
63+
possible to control your computer by typing commands into a prompt. Once you
64+
know the commands, this is often the most powerful way to use a computer.
65+
However, it can feel a bit like casting spells with incomprehensible
66+
incantations so may, at first, appear frightening.
67+
68+
Find your computer's command prompt depends upon which operating system you're
69+
using:
70+
71+
* Windows: in the search area of your start menu, type `cmd` and
72+
press enter.
73+
* Mac OSX: use the finder to go to the Applications folder and then the
74+
Utilities folder. Open the "Terminal" app.
75+
* Linux: look for the "Terminal" app in your desktop's menu.
76+
77+
## I Want a Shortcut!
78+
79+
When `pip` installs software it doesn't automatically create a shortcut or menu
80+
item for you. Happily, someone has created a utility called `shortcut` to do
81+
this for you.
82+
83+
Simply use `pip` to install `shortcut` and then use `shortcut` on Mu:
84+
85+
```
86+
pip3 install shortcut
87+
shortcut mu
88+
```

en/howto/read_logs.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
layout: default
3+
title: How to read the logs in Mu.
4+
i18n: en
5+
---
6+
# How to read the logs in Mu
7+
8+
Log files are a way for Mu to keep track of what it has been doing. These is
9+
**very** useful when trying to work out why Mu has behaved in a certain way or
10+
if Mu has encountered an error. Logs also help work out how students may have
11+
got Mu into a certain undesirable state.
12+
13+
In any case, Mu keeps up to 5 days worth of logs in the user's directory the
14+
operating system defines for such things. Since this directory changes from
15+
system to system and may even depend on the way in which a computer is
16+
configured (for example, user data is stored on a network drive), Mu provides a
17+
shortcut to the *current log file*: click on the small cog icon in the bottom
18+
right hand side of Mu, right next to the name of the current mode.
19+
20+
Mu **appends** lines to the log file, so the most recent line is at the end of
21+
the logs.
22+
23+
Every time Mu starts it logs details about the system, including the paths to
24+
the various places it stores things such as log files, settings and sessions.
25+
This will look something like:
26+
27+
```
28+
-----------------
29+
30+
Starting Mu 1.0.0.beta.15
31+
2018-03-19 16:51:22,385 - root:95(run) INFO: uname_result(system='Linux', node='heraclitus', release='4.13.0-36-generic', version='#40-Ubuntu SMP Fri Feb 16 20:07:48 UTC 2018', machine='x86_64', processor='x86_64')
32+
2018-03-19 16:51:22,448 - mu.logic:499(__init__) INFO: Setting up editor.
33+
2018-03-19 16:51:22,449 - mu.logic:510(__init__) INFO: Settings path: /home/ntoll/.local/share/mu/settings.json
34+
2018-03-19 16:51:22,449 - mu.logic:511(__init__) INFO: Session path: /home/ntoll/.local/share/mu/session.json
35+
2018-03-19 16:51:22,449 - mu.logic:512(__init__) INFO: Log directory: /home/ntoll/.cache/mu/log
36+
2018-03-19 16:51:22,449 - mu.logic:513(__init__) INFO: Data directory: /home/ntoll/.local/share/mu
37+
2018-03-19 16:51:22,467 - mu.logic:521(setup) INFO: Available modes: python, adafruit, microbit, debugger, pygamezero
38+
2018-03-19 16:51:22,518 - mu.logic:856(change_mode) INFO: Workspace directory: /home/ntoll/mu_code
39+
2018-03-19 16:51:22,519 - mu.logic:560(restore_session) INFO: Restoring session from: /home/ntoll/.local/share/mu/session.json
40+
```
41+
42+
Each time Mu restarts it emits a line like this: `-----------------`. This
43+
makes it easy to visually find restarts in the log file.
44+
45+
Each line in the log file follows a pattern:
46+
47+
* It starts with the date and time of the log entry, YYYY-MM-DD HH:MM:SS
48+
* Next comes the name of the file and the line number that generated the log
49+
entry.
50+
* Following this, in parenthesis, is the name of the function being evaluated
51+
when the log entry was created.
52+
* Next comes an indication of the type of log entry this is. This will be one
53+
of the following values: `DEBUG`, `INFO`, `WARNING`, `ERROR` or `CRITICAL`.
54+
See the [Python documentation on logging](https://docs.python.org/3.6/library/logging.html#logging-levels) for what they mean.
55+
* Finally, you'll see some sort of textual output, often a helpful message
56+
explaining why the log was written, or perhaps a copy of some data which Mu
57+
was processing at the time of the log entry.
58+
59+
If you ever find a bug in Mu, please attach a **complete** copy of the log file
60+
for the day when you discovered the bug (and it'd be helpful if you point out
61+
the lines in the log for when the bug was encountered).

img/en/howto/create_load_save.png

6.15 KB
Loading

img/en/howto/microbit_files.gif

413 KB
Loading

img/en/howto/microbit_files.png

4.21 KB
Loading

img/en/howto/winstall1.png

18.8 KB
Loading

img/en/howto/winstall2.png

25.8 KB
Loading

img/en/howto/winstall3.png

18.4 KB
Loading

img/en/howto/winstall4.png

20.2 KB
Loading

img/en/howto/winstall5.png

25 KB
Loading

img/en/howto/winstall6.png

15.3 KB
Loading

0 commit comments

Comments
 (0)