Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 2531 #3151

Merged
merged 19 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 16 additions & 30 deletions en/lessons/mac-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Setting Up an Integrated Development Environment for Python (Mac)
layout: lesson
date: 2012-07-17
tested_date: 2023-11-16
authors:
- William J. Turkel
- Adam Crymble
Expand Down Expand Up @@ -47,37 +48,18 @@ drive.

### Install a text editor

There are many text editors that you can use to write, store, and run Python commands. Komodo Edit is the one used in this lesson. It is a free and open source code editor. If you prefer to use
another editor, there are many [other text editing options][]. Some of our
testers prefer a program called [BBEdit][]. Which you use is up to
you, but for the sake of consistency in our lessons, we will be using
Komodo Edit. You can download a copy of Komodo Edit from the [Komodo
Edit website][]. Install it from the `.DMG` file
There are many text editors that you can use to write, store, and run Python commands.
Sublime Text is the one used in this lesson. If you prefer to use another editor, there are many [other text editing options][].
Some of our testers prefer a program called [BBEdit][]. Which you use is up to
you. You can download a copy of Sublime Text from the [Sublime Text website][].


##### Make a “Run Python” Command in Komodo Edit
##### Set up in Sublime Text

Now you need to set up the editor so that you can run Python
programs.

If you don’t see the Toolbox pane on the right hand side, choose
`View->Tabs & Sidebars ->Toolbox`. In the Toolbox window, click on the gear icon and select
“`New Command…`“. This will open a new dialog window. Rename your
command to “`Run Python`” and feel free to change the icon if you
like. In the “`Command`” box, type

``` python
%(python3) %f
```

and on the Advanced Options tab under "Start in," enter

``` python
%D
```

Click OK. Your new Run Python command should appear in the Toolbox
pane.
From the menu, choose
`Tools -> Build System -> Python`.

Step 2 – “Hello World” in Python
--------------------------------
Expand Down Expand Up @@ -110,12 +92,16 @@ program and save it to your `programming-historian` directory as
print('hello world')
```

Your chosen text editor should have a “`Run`” button that will allow you
to execute your program. If you are using BBEdit, click on the
Your chosen text editor should have a “`Run`” or “`Build`” button that will allow you
to execute your program. If you are using Sublime Text, click `Tools -> Build` (or type `⌘B`). If you are using BBEdit, click on the
“\#!” button and Run. If all went well, it should look something like
this:

{% include figure.html filename="BBEdit-hello-world.png" caption="'Hello World' in Python on a Mac" %}
{% include figure.html filename="BBEdit-hello-world.png" caption="'Hello World' in Python on a Mac with BBEdit" %}

Or, with Sublime Text:

{% include figure.html filename="en-or-sublimetext-hello-world.png" caption="'Hello World' in Python on a Mac with Sublime Text" %}

### Interacting with a Python shell

Expand Down Expand Up @@ -161,5 +147,5 @@ order, we suggest you next try '[Understanding Web Pages and HTML][].'
[Beautiful Soup]: http://www.crummy.com/software/BeautifulSoup/
[other text editing options]: http://wiki.python.org/moin/PythonEditors/
[BBEdit]: https://www.barebones.com/products/bbedit/
[Komodo Edit website]: http://www.activestate.com/komodo-edit
[Sublime Text website]: https://www.sublimetext.com/download
[Understanding Web Pages and HTML]: /lessons/viewing-html-files
6 changes: 5 additions & 1 deletion es/lecciones/instalacion-mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ print('hola mundo')
```
El editor de texto que seleccionaste debe tener un botón "`run`" que te permitirá ejecutar tu programa. Por ejemplo, si estás utilizando TextWrangler, haz clic en el botón "`#!`" para ejecutarlo. Si todo funciona bien (es posible que no, con lo cual habrá que revisar las diversas instalaciones y configuraciones), deberás ver algo como sigue:

{% include figure.html filename="BBEdit-hola-mundo.png" caption="'Hola Mundo' en Python en una Mac" %}
{% include figure.html filename="BBEdit-hola-mundo.png" caption="'Hola Mundo' en Python en una Mac, con BBEdit" %}

O, con Sublime Text:

{% include figure.html filename="es-tr-sublimetext-hola-mundo.png" caption="'Hola Mundo' en Python en una Mac, con Sublime Text" %}

### Interactuar con el intérprete de comandos (*shell*) de Python

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 12 additions & 19 deletions pt/licoes/instalacao-mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Configurar um ambiente de desenvolvimento integrado para Python (Mac)
slug: instalacao-mac
layout: lesson
date: 2012-07-17
tested_date: 2023-11-16
translation_date: 2021-05-13
authors:
- William J. Turkel
Expand Down Expand Up @@ -50,26 +51,13 @@ Para que você se organize, o ideal é que você tenha um diretório (i.e., past

## Instale um editor de texto

Existem vários editores de texto que você pode utilizar para escrever, armazenar e executar comandos em Python. O Komodo Edit é o utilizado nesta lição, correspondendo a um editor gratuito e de código aberto. Mas existem [outros editores][] se você preferir. Por exemplo, alguns dos nossos colaboradores preferem o programa [BBEdit][]. Você pode escolher qual editor mas, para manter a consistência entre as lições, nós iremos utilizar o Komodo Edit. Você pode fazer o download diretamente do [site do Komodo Edit][]. Faça a instalação a partir do ficheiro `.DMG`
Existem vários editores de texto que você pode utilizar para escrever, armazenar e executar comandos em Python. O Sublime Text é utilizado nessa lição. Se vosê preferir usar outro editor, existem muitas outras [opções de editores de texto][]. Alguns dos nossos usuários preferem um programa chamado [BBEdit][]. A escolha é sua. Pode descarregar uma cópia do Sublime Text a partir do [website do Sublime Text][].


#### Faça um comando “Run Python” no Komodo Edit
#### Configurar no Sublime Text

Deve agora configurar o editor para que seja possível executar programas em Python.

Se você não visualizar a barra de ferramentas (Toolbox) do lado direito, selecione a opção do menu `View -> Tabs -> Toolbox`. Na janela Toolbox, clique no ícone da engrenagem e selecione “`New Command…`”. Uma nova janela de diálogo irá abrir e você deve renomear o seu comando para “`Run Python`”. Fique a vontade para alterar também o ícone. Na caixa “`Command`”, digite:

``` python
%(python3) %f
```

e na aba de opções avançadas, sob o texto "Start in," digite:

``` python
%D
```

Cique no botão OK e o seu novo comando "Run Python" deve aparecer no painel de ferramentas.
A partir do menu, escolha `Tools -> Build System -> Python`.

## Passo 2 – “Olá Mundo” em Python
--------------------------------
Expand All @@ -93,9 +81,13 @@ No seu editor de texto, crie um novo ficheiro, entre o seguinte programa de duas
print('Olá Mundo')
```

O comando “*Run Python*” permite que você execute o seu programa. Se você escolheu um outro editor, este deve ter uma funcionalidade semelhante. Se está a usar o BBEdit, clique em “#!” e no botão *Run*. Se tudo correu bem, o ecrã deverá mostrar algo como apresentado de seguida:
O comando “*Run Python*” permite que você execute o seu programa. Se você escolheu um outro editor, este deve ter uma funcionalidade semelhante. Se está a usar Sublime Text, clique em `Tools -> Build` (ou digite `⌘B`). Se está a usar o BBEdit, clique em “#!” e no botão *Run*. Se tudo correu bem, o ecrã deverá mostrar algo como apresentado de seguida:

{% include figure.html filename="BBEdit-ola-mundo.png" caption="Olá Mundo em Python no Mac, com BBEdit" %}

Ou, com Sublime Text:

{% include figure.html filename="BBEdit-ola-mundo.png" caption="Olá Mundo em Python no Mac" %}
{% include figure.html filename="pt-tr-sublimetext-ola-mundo.png" caption="Olá Mundo em Python no Mac, com Sublime Text" %}

## Interagindo com a linha de comandos do Python

Expand Down Expand Up @@ -130,7 +122,8 @@ Agora que você e o seu computador estão preparados, podemos seguir para tarefa
[Time Machine]: http://support.apple.com/kb/ht1427
[site do Python]: https://www.python.org/downloads/mac-osx/
[Beautiful Soup]: http://www.crummy.com/software/BeautifulSoup/
[outros editores]: https://wiki.python.org/moin/PythonEditors/
[opções de editores de texto]: https://wiki.python.org/moin/PythonEditors/
[website do Sublime Text]: https://www.sublimetext.com/download
[BBEdit]: https://www.barebones.com/products/bbedit/
[site do Komodo Edit]: https://www.activestate.com/products/komodo-ide/downloads/edit/
[Noções básicas de páginas web e HTML]: nocoes-basicas-paginas-web-html