This tutorial is geared toward those who are completely new to Python development. If you have any questions, please ask away.
Installing Python
The first thing you'll want to do is download and install the latest version of Python 3 onto your system. At time of writing, that version is 3.6.4. Version 3.3 or greater is required.
Since AppGameKit for Python currently only supports Windows x86, be sure to download and install either "Windows x86 executable installer" or "Windows x86 web-based installer" listed at the bottom of the page.
The default install settings are fine to use.
Developing with IDLE
Python comes with its own minimal IDE called IDLE. These steps will get you started developing with IDLE.
First, be sure to have downloaded the appgamekit.pyd file. (Note that the filename cannot be changed.)
- Start IDLE. This opens the "Python Shell" window.
- File -> New File. This creates a new script file.
- Write your script. For this example, just copy/paste the basic "Hello, World" script from the project page under "Installation and Usage".
- File -> Save. Save the script file into the same folder that your appgamekit.pyd file is located.
- Run -> Run Module. This runs your script and you should now see "Hello, World!" in an AppGameKit window.
Developing with PyCharm Community Edition
PyCharm Community Edition has more features than IDLE, such as easier integrated help and type checking. To use both of these features, download the appgamekit.pyi file into the same folder as the pyd file.
Before we begin, download and install PyCharm Community Edition. The default settings are fine.
- Start PyCharm. if this is your first time running PyCharm, you'll need to accept its license, decide whether to share anonymous usage statistics or not, and select your UI theme. If you want, you can "Skip Remaining and Set Defaults", but you may also want to go through all the steps and see what features PyCharm provides.
- Create New Project.
- Set the location of your project. Before clicking "Create" click on "Project Interpreter" right below the location. Here you can choose to use a Virtualenv, which is a localized copy of Python's files that will be created specifically for your project, or we can use an existing interpreter. For this example, let's use the installed interpreter rather than a virtualenv.
- Click "Existing Interpreter". If this is the first time PyCharm has been run, the interpreter line might be blank.
- Click the gear button and select "Add Local..."
- Select "System Interpreter" and find the location where you installed Python 3.6. PyCharm should find it pretty easily itself.
- Click OK.
- Now click "Create"
- In the window that opens, select File -> New, then select "Python File" and call the file "main.py"
- Make sure that the appgamekit.pyd and appgamekit.pyi files are in the same folder as your main.py file.
- Write your script. For this example, just copy/paste the basic "Hello, World" script from the project page under "Installation and Usage".
- Run -> Run... then select "main" in the drop down that opens. After running it the first time, you'll be able to select "Run 'main'" from the Run menu.
Note
The PYI file is only needed while developing. PYI files are only used by IDEs and contain no code.