On this page some of my experiments with Python using the version for the Nokia Series 60 platform are introduced. All these programs come as python sources and as free software, copyright by Goetz Schwandtner. For the Python interpreter (PyS60), see the links section.
Rabinowitz [4] published an algorithm to calculate the
digits of π. In spigot.py
his Pascal program is implemented in
a python class together with a spigot algorithm for the base
e for the base of the natural logarithm, derived from his paper.
spigot.py
may be run as a standalone script on PyS60, but may also
be imported as a module providing the classes SpigotPi and SpigotE into any
Python interpreter with version at least 2.2. In the standalone version on
PyS60, just select the algorithm, enter the number of digits and then select
Options->Save
. The results will also be written to the console
for reviewing after the program run.
This game was intended as a proof of concept: A game completely developed using only a smartphone. The game is fully playable and completable, but it is still in a proof of concept stage offering only three levels. But you can create own levels by implementing them in the Gamefield class.
This game is influenced by the games Oxyd and Mirror Magic. Each level of the game consists of a rectangular grid containing different elements: Lasers, mirrors, targets and more. The aim is to orient the mirrors to hit the targets with a laser beam and destroy them, where fixed and automatic components may interrupt your plans.
For more details, see the game homepage.
News on 2008-08-19: Version 1.0 released!
This is a frontent for the appswitch module [5] and provides a basic task manager functionality: List apps (with or without hidden apps), switch to an application, kill an application.
The kill command be used with extreme caution. With the kill command it is possible to kill the telephone app ("Telefon") and after that the power button menu will be inoperative. To switch off the device you will then need special software or simply remove the battery. So: Don't try this at home, kids!
The AppKill script is ready to be executed as standalone application, e.g.
by creating an installer with using the Ensymble [6] command:
ensymble.py py2sis appkill.py appkill.sis
A nice little demo application showing Pascal's triangle in a short object
oriented implementation. Once started, the script displays the triangle as
colored boxes, and the colors can be changed from uniform to colors depending
on the number modulo a constant Keyboard help:
|
A short hack of two functions converting Roman numerals to decimal numbers
(toDecimal
) and decimal numbers to Roman numerals
(toRoman
) for numbers
Usually, Roman numerals are restricted to at most three occurrences of one
of the symbols I
, X
and C
. In our
conversion functions we allow at most four consecutive occurrences of the
symbols I
, X
, C
and M
, as
used in some occasions. For
the subtractive version of numerals, only the next smaller numeral from the set
{I
, X
, C
} is allowed,
e.g. IV
(=4) and CMXDIX
(=999) are permissable, while
VX
, IC
and IM
are not.
This program displays a "yellow sticky note" in the upper part of the
screen. Once started, the note is shown throughout all programs, until the user
puts the program to foreground using the devices task manager and exits
the program or hides the note. The menu entries of the program are straightforward:
Show
and Hide
switch the note display on and off, while
Set note
lets you enter the text to display. Due to the restrictions
of the PyS60 dialogs, only one (not very long) line of text can be entered, which will
automatically be wrapped in the display.
While this application has some use of its own, especially when built as standalone app, it is also a nice example for some PyS60 topics:
topwindow
module.wrap_all
wrap_line
.Quicknote.sis
installer:
ensymble.py py2sis Quicknote.py Quicknote.sis
Quicknote includes all code to cleanly run and exit a standalone PyS60 app.
As usual, I will take no responsibilities for problems connected with the use of my programs. For me, they have been working fine, but that does not mean that there could not be problems, bugs etc.
Last change: 2008-08-19 | [Back to my homepage] |