• 20/02/2023
  • homesmartjp
  • 1098 Views

I want to use Python on iPhone/iPad -Let's start pythonista

There are many people around the world who want to use Python anytime, anywhere.I am one of them, but if he wanted to make a program on a train or plane, he had to carry a laptop.But the times have changed.Now you can easily develop Python on your iPhone/iPad.This time, let's introduce how to use Python anytime, anywhere using the app called Pythonista.

How to use Python on iOS?

There are some options when you want to use Python on your iPhone/iPad (iOS).First of all, one method of using the paid application Pythonista, the free app Python3 IDE, etc.In addition, there is a method of connecting an application such as VNC or SSH to a remote computer to execute Python on a remote PC.

Of course, if you want to connect to a remote computer, you can operate the usual Python development environment with a smartphone.However, since we work over the Internet, when using on the go, we always use mobile communication.Therefore, if you use the former iOS app, you can complete everything in your device.In this case, you can easily enjoy Python on a place where there is no Internet connection, on trains and airplanes.

In the iOS App Store, there are some apps that can move Python.So, I tried some of these apps, but paid (1220 yen as of November 2019), but pythonista is the most stable.The hurdle is a little high because it is paid, but if you want to use Python anywhere or use a Python app on the iPhone/iPad, it will not hurt.So, in this article, I will introduce Pythonista.

About pythonista

Let's take a look at some great points about pythonista.Pythonista contains not only the Python execution environment but also an easy -to -use development editor.It is better to write a program on the editor and run Python with one execution button.In addition, it contains various functions specialized in iOS.You can also draw a graph or create a GUI tool.In other words, it can be evaluated not only to move Python with iOS, but also to use various functions specialized in iOS.You can create useful tools using iPhone and iPad functions.

iPhone/iPadでもPythonが使いたい - Pythonistaを始めよう

There is also a GUI editor, and parts can be placed on the screen and screen design.This is a nice feature, as it is convenient to be able to operate the screen with the GUI if you think about using the program to use the program.

What I particularly like is that you can easily draw graphs.Originally, Python has an excellent graph drawing library called Matplotlib, but Pythonista can be used without any settings.

And the editor that describes the program is very good.When the first few characters are type, the input candidate is displayed at the bottom of the screen.It is convenient to choose a function that has not been used and has forgotten the accurate spelling, and you can select it from the candidate.

Create a program with pythonista

Let's actually make a program.If you are already able to use Python, you can start a program without worrying.Open Pythonista and press the [+] button at the bottom left of the screen, you will be asked what to make. Select [Empty script].Then, enter the file name such as "Hello" and tap the [Create] button on the upper right.Then, a blank program editing screen appears.

So, write a program and press the execution button on the upper right to run the program.

print("Hello, Python")

After executing, press the split button at the top of the screen, the editor on the left, the execution screen and the screen can be developed separately.

Let's expand pythonista with stash

By introducing a shell called STASH, the function of Pythonista can be greatly expanded.By introducing Stash, you can install any project from GitHub using the version control system Git, or install an external library using a PIP command.(However, when using PIP, some move and some do not move.)

ShaShを導入するには、Pythonistaのコンソールに以下のコマンドを入力して実行する。コンソールを表示するには、画面の右端から左側へスワイプし、画面下部(ソフトウェアキーボードのすぐ上)にある「>」に次のコマンドを入力する。

import requests as r; exec(r.get('https://bit.ly/get-stash').text)

When the command is executed, restart Pythonista.Then, "Launch_stash" in "This iPhone" or "This iPad".The file "Py" is created, so you can start Stash by executing it.When you type "Help" or press the [Tab] key, a list of available commands will be displayed.Ping commands can also be used, so you can use them for some communication confirmation.

summary

This time, we introduced Pythonista, which turns the iPhone/iPad into a Python development machine.It is convenient to be able to execute the useful tools you have created on iOS, but it is also interesting to make an iPhone/iPad -only tool or game using the unique functions prepared in Pythonista.Try it with pythonista, as the range of Python is expanded.