Forum Archive

how To import modules such as pygame etc

themusicman

Hi all - new to coding and Pythonista but loving learning

So, I have a script that I want to run that contains the pygame module. When I run the script which has on a line...

Import pygame

I get an error message informing me the module is not found.

How does one install additional modules please? Is this possible?

Thanks.

hmartin

The i is lowercase...

import pygame
themusicman

Yep, I think it was just capitalised automatically on the forum. In my pythonista code, it is lowercase.

mikael

@hmartin, pygame is not available in Pythonista as it contains C components, and only C components you can run on iOS are those that come installed with an app.

But you can ”pip install” pure Python components - search for ”stash ywang” in the search engine of your choice.

Drizzel

The scene module comes natively with pythonista, and there are a few examples that might help

themusicman

Super responses, thanks folks.

I shall take a look into 'scene' and try to figure it out. I have been working on learning python and came up with a version of Connect4 on the Mac using PyCharm. I'll see if I can use 'scene' or even the UI that is provided with pythonista to do it, thanks for the heads up @Drizzel.

I'll look into stash ywang too, @mikael - many thanks.