We’re back! As promised at the conclusion of Pythonista 101, we’re back with a new series detailing Pythonista and the process of building useful utilities in the Python language.
Before you’re introduced to the course material for Secondary Pythonista, let us briefly review what was covered in Pythonista 101.
A Brief Review of Pythonista 101
Just what exactly did we talk about in Pythonista 101? Well, the goal was to familiarize you, dear reader, with the app Pythonista and what it’s capable of. We looked at what the app is designed to do, namely write and run Python scripts, but we went a little beyond that.
Part of what makes Pythonista such a special app is the robust community growing around it. The Pythonista forums are a good place to find scripts written by other Pythonista users. Scripts that are often useful just on their own. Load them into your copy of Pythonista and make use of them. But beyond that, these scripts are often quite useful as educational tools. Seeing how a programmer solved a particular problem is frequently the most useful way to learn programming. Since Python is a language designed with code readability in mind, this sort of watch-and-learn technique is especially important.
I glossed over two important things there: first, loading a script into your copy of Pythonista, and second, reading a program and learning from it. These were two things specifically mentioned in Pythonista 101.
In the first article, “The Scripting Community”, we learned how to make use of a script written by Pythonista creator Ole Zorn. This particular script allows for a new Pythonista script to be loaded into your copy of the app by taking a Github Gist URL in your clipboard as input. We even went one step further and added this script as a button in Pythonista’s Actions Menu. This lets us simply copy a Gist URL, open Pythonista, and press the “New from Gist” button. Smooth and efficient. If you haven’t yet added this ability to your copy of Pythonista I strongly encourage you to do so now. Go ahead and refer to the Pythonista 101 article and then come on back to here when you’re done.
All set? Good.
The second thing we discussed was the process of taking an existing script, learning from it, and then applying that knowledge practically to make modifications to it. As an example we had the Meme Generator, a script which took an image from your clipboard as input, then requested a top caption and a bottom caption, styled the text, and applied it to the image. Without needing to really consult documentation or be briefed in every aspect of the Image module, we were able to control the appearance of the captioned text by looking at how the script was written. Watch for this watch-and-learn technique begin used in this new course.
A Re-Introduction to Pythonista
Alright, now that we’ve reviewed what was covered in Pythonista 101 let’s quickly reacquaint you with the Pythonista interface.
Here we have the main interface for Pythonista. The Card Stack on the left, the Editor on the right. Pretty straight forward.
Lets dig a little deeper into the Editor interface. You’ll see the six main buttons in the Editor toolbar highlighted. Remember what they do?
- This slides the Card Stack list of scripts back in.
- Brings up the settings for the Editor.
- Fades in a search box letting look for text within the open script. Very useful, as you’ll probably discover later in this series.
- Opens the Pythonista Documentation. Also very useful.
- The Action Menu. Useful for exporting your script, but remember how we can extend it with scripts of our own, like the “New from Gist” script.
- Executes our script.
Now I’d be remiss if I failed to mention the Console, the built-in Python Interpreter.
Here’s how we get access to the Console, a slide to the left from this handle here.
And here we have the console. A lot of the scripts you’ll come across will at least present some log messages to the console, if not expect input from it. In this series we’ll be outputting to the console at various times, so make sure you remember where to find it.
What Secondary Python Will Cover
That brings us to the particulars of this series. Just what will it include? Well, Secondary Python will be in four parts:
- Solving Problems with Python — we’ll look at the project’s goals, what we need to do to accomplish those goals, and examine the available Python modules and tools at our disposal, creating a plan-of-attack.
- Put the Pieces Together — building from our previous plan, we’ll start writing the script, examining the modules we’ll be using, learning how to find out what they can do, really begin crafting our script.
- Test, Re-write, Test Again — the script will continue to be fleshed out, using and understanding trial-and-error programming, show why making mistakes isn’t a bad thing, and particularly how we can grow from them.
- Evaluating the End Product — here the script will be finalized, we’ll look at how to run and use it regularly, reflecting on the process as a whole, and look at how the script could be improved upon in the future.
Class is Back in Session
There you have it! Secondary Pythonista will build on the skills you’ve developed in Pythonista 101. If you haven’t gotten a chance to review Pythonista 101 then I strongly encourage you to do so now! Don’t wait! You can find Pythonista 101 here on AppStorm under the How-to section. Give them a read. You’ve got until next Friday when our next lesson, Solving Problems with Python debuts.