Third Edition Linux/Manual installation
Posted: November 29, 2019 at 8:12 pm
If you’re running Linux or an old version of macOS, or you just don’t want to use the installer available at helloworldbook3.com, you’ll need to install each of the pieces of software needed for the book yourself.
The things you need are:
Python 3 (version 3.7.3 or greater)PyQt5PygameThe easygui Python moduleQt Designer (for Qt 5)
You can download Python from python.org, and a copy of Qt Designer is available here. Once you’ve installed Python, you can use a command called pip to download the modules you need. (PyQt5, Pygame, and easygui.) Open a Terminal or Command Prompt window and type:
pip install PyQt5 pygame easygui
(Depending on how you installed Python, you may need to run the command in an administrative command prompt, or type “sudo pip install” instead of just “pip install”.)
On some Linux distributions, like Ubuntu, you can use a kind of program called a “package manager” to install this software more easily. The exact command you need depends on your system, but on Ubuntu 19.10, you can type this command to install everything:
sudo apt install python3-pyqt5 python3-pygame python3-easygui qttools5-dev-tools
If you go this route, you don’t need to download anything from the Python website. apt will do all of the work for you.
Read More...Second Edition Mac Installation with Homebrew
Posted: November 3, 2015 at 9:43 pm
These instructions are for the Second Edition of Hello World!. If you’re using the Third Edition, there’s an easy-to-use software package available for download at helloworldbook3.com.
Because Homebrew no longer supports Python 2, these instructions might not work correctly anymore.
We previously offered an installer package for Mac OS X that downloaded and installed all necessary modules and software. Unfortunately, changes to recent versions of OS X have caused our installer to no longer work properly, so to install Python and all the modules required by the book, we now recommend using a program called Homebrew. Homebrew is a package manager for Macs. In other words, it’s a way to install, update, and uninstall software. Here’s how you use Homebrew to install the book’s software:
Install Homebrew by opening Terminal, copy-pasting in the following command, and pressing Return:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
Note: at the “Password:” prompt, type the password you use to log in to your computer. You won’t see anything appear on the screen; this is normal for security reasons.
Run these commands in Terminal to install everything you need:
brew install cp4k/hello-world-2/hello-world-2
finish-hello-world-2-installation.py
Then, you’ll have all of the software you need for the book. (Note: Homebrew won’t download the book’s sample code for you. …
Distributing Python Programs, Part 2: The Harder Stuff
Posted: July 14, 2015 at 2:07 pm
In Part 1, we looked at using PyInstaller to package up very simple programs into executables. For more complex programs that use other Python modules like PyGame or PyQt, the process is similar, but there are a few other things you need to do. Let’s talk about Pygame first.
PyInstaller and Pygame
The best way to show this is with an example. Let’s make LunarLander (from Ch 24) into a shareable program. For this one, we’ll make a single-folder shareable version, instead of a single-file executable (it simplifies it a little.) That means users will have a folder which contains the executable, LunarLander.exe, as well as a bunch of supporting files. You can zip this folder up and send people the .zip file. They will just need to extract it somewhere on their computer in order to run it.
We’ll start by making a new folder for our sharable LunarLander. Call it ‘LunarLanderSharable’ We need to put the LunarLander.py file there, as well as the two images that the program uses: lunarlander.png (the rocket) and moonsurface.png (the moonscape).
The first “tricky” thing to know is that, for some reason, when using the Font object, using the default font in Pygame doesn’t work with PyInstaller. …
Distributing Python Programs, Part 1: The Easy Stuff
Posted: July 13, 2015 at 2:07 pm
Hello World! Computer Programming for Kids and Other Beginners is about learning to code. One of the first things you need to do is install Python, so you can run your code. But what if you want to share your program with someone who doesn’t have Python installed?
In some programming languages, this is pretty easy. Languages like C and C++ are compiled, which means the code is transformed into runnable or executable code. You can then share the executable and anyone can run it on their machine.
But Python is an interpreted language. There’s no compiler – instead, the Python interpreter executes the code. That means there’s no executable version of your program you can share. (Well, technically there is a compiler, but it compiles to Python bytecode, not to something that you can run directly.) To run a Python program, you need to have the Python interpreter on the computer. But that doesn’t mean you can’t share your Python programs. It’s just a little trickier.
Basically, to share a Python program so it can be run on a computer that doesn’t have Python installed, you need to bundle it up with a copy of the Python interpreter. There are some …
Why everyone should learn to code
Posted: November 30, 2014 at 1:49 pm
It’s a digital world. Software plays a huge role in our everyday lives. It’s everywhere. Google, Facebook, Twitter, Amazon, Apple. Computers, phones, TV’s, cars, cameras,… even some shoes and clothes. Software is all around us, including some places you probably don’t realize. Not everyone is going to be a software developer, or “coder”, of course. But most of us use a computer these days, for work, school, or entertainment. And if you use a computer, there will come a time when knowing even the basics of programming will help you. It’s unfortunate that most of our school systems don’t teach any coding until high school, and then only as an elective . Kids in elementary and middle school could and should start learning some basics of computer programming.
You don’t have to be a hardcore coder to do useful and fun stuff with programming. Lots of games have ways to interact with them by writing a bit of code (for example, Minecraft “modding”). If there’s some task that you do on your computer every day (or every week, or every month…) and that task needs several steps, you probably get tired of doing that same thing over again every time. If …
Hello World! Second Edition Installation
Posted: January 15, 2014 at 9:14 pm
It is HIGHLY RECOMMENDED that you use the Hello World! Installer to install all resources needed for the book, including Python and all the modules listed here. The Hello World! installer can be found in the “Downloads” section here.
If you can’t (or don’t want to) use the Hello World! Installer, you can install Python and all the modules you need manually. The packages you need are:
Python 2.7.x
Pygame (any version)
Easygui (any version). We’ve tested on version .83.
PyQT4 (any minor version)
Read More...
Hello World Second Edition
Posted: December 28, 2013 at 8:15 pm
This year we have been working on an update to Hello World! Computer Programming for Kids and Other Beginners. The Second Edition hit bookstore shelves in late December 2013.
The first thing you’ll notice about the new edition is that it’s in full color, including the code listings, which have syntax coloring. Here are some of the other changes:
We added a section on Python Dictionaries
We added a chapter explaining in detail how the Chapter 10 Skier program works
We added a chapter about making an AI (Artificial Intelligence) robot that competes against another AI in a simple battle game.
We switched from using PythonCard for GUIs to using PyQt. The developers of PythonCard stopped working on it quite a while ago, and it’s no longer supported. Qt (and the Python implementation, PyQt) is widely used.
We added notes throughout the book on the differences between Python 2 and Python 3.
One of the things that didn’t change is that we are still using Python 2. Although Python 3 has been out for a few years, many programmers are still using Python 2. Also, much of the existing Python code in the world is Python 2, and there are still a lot more 3rd-party modules that …
Read More...PythonCard Mac Fix
Posted: September 16, 2012 at 4:17 am
Some of our readers have had troubles with PythonCard not working on Mac OS X. Here’s a fix. (We found it on this website):
Go to Macintosh HD/Library/Frameworks/Python.framework/Versions/2.5/Lib/python2.5/site-packages/PythonCard
Drag the file called “model.py” to the Trash.
Download and unzip this file (http://www.tjleone.com/model.py.zip). Drag it into the PythonCard folder.
In the PythonCard folder, go to tools/resourceEditor.
Control-click the file called resourceEditor.py and choose Make Alias.
Rename the alias to “Resource Editor” (without the quotes)
Drag the alias to somewhere you’ll be able to find it later.
When you’re going through the book and you need to open Resource Editor, double-click the alias to open it in IDLE, then choose Run->Run Module in the menu.
Carter
Korean translation
Posted: May 8, 2012 at 2:29 am
A little while ago, we got a copy of the Korean translation of our book….
Read More...12 Days of Python – Kindle Winner!
Posted: December 25, 2011 at 9:29 pm
We did a random draw for the Kindle touch from all the Twitter, Facebook and Blog comment entries. (We used a Python script, of course!)
The winner of the Kindle is Bryan Campbell of Danville, PA. Congratulations to Bryan, and thanks to everyone who followed the 12 Days of Python.
Read More...