Nauč se Python > Kurzy > Beginners course PyLadies > Installation > Editor installation > Gedit

Instalace Gedit

Linux installation:

Fedora
$ sudo dnf install gedit
Ubuntu
$ sudo apt-get install gedit

For Windows and macOS you can probably download Gedit from its webpage.

Settings

To set up Gedit you have to go to Preferences.

Line numbers

In View check Display Line Numbers

Indent

Editor:

  • Tab width: 4
  • Insert spaces instead of tabs
  • Enable automatic indentation

Colours:

Colouring of code is automatic if you save the file with proper extension – e. g. .py for Python.

So it's better if you save your file as early as possible.

Indentation practice

As we already mentioned it's important in Python by how much spaces is line indented. So we will have to learn to quickly indent block of text.

First of all copy following text into your editor.

OPHELIA:
Good my lord,
How does your honour for this many a day?
HAMLET:
I humbly thank you; well, well, well.
OPHELIA:
My lord, I have remembrances of yours,
That I have longed long to re-deliver;
I pray you, now receive them.
HAMLET:
No, not I;
I never gave you aught.
OPHELIA:
My honour'd lord, you know right well you did;
And, with them, words of so sweet breath composed
As made the things more rich: their perfume lost,
Take these again; for to the noble mind
Rich gifts wax poor when givers prove unkind.
There, my lord.

Hamlet, W. Shakespeare

This text is not well-arranged so we will indent it like that:

OPHELIA:
    Good my lord,
    How does your honour for this many a day?
HAMLET:
    I humbly thank you; well, well, well.
OPHELIA:
    My lord, I have remembrances of yours,
    That I have longed long to re-deliver;
    I pray you, now receive them.
HAMLET:
    No, not I;
    I never gave you aught.
OPHELIA:
    My honour'd lord, you know right well you did;
    And, with them, words of so sweet breath composed
    As made the things more rich: their perfume lost,
    Take these again; for to the noble mind
    Rich gifts wax poor when givers prove unkind.
    There, my lord.

To indent one line set you coursor in the beginning of the line and press Tab. With every press you will indent the like by 4 spaces.

If you indent too much, press Shift+Tab.

If you would want to indent more lines just highlight them and press Tab. For undo press Shift+Tab.


Toto je stránka lekce z kurzu, který probíhá nebo proběhl naživo s instruktorem.