Python runs everywhere, even on a pocket pc. Get PythonCE at http://pythonce.sf.net. Once installed we can get the python interpreter.
But that won't be enough, now would it? Upon further investigation, I see that i can do tcl/tk. Now, that's cool.
However, great effort needs to be done to actually get any tkinter script running.
here's what i did:
- Get and install pythonce
- Get tkinter-files.zip
This is the necessary steps that I missed that resulted in failure to import Tkinter.
- Open tkinter-files.zip. Copy everything from windows\* to my Pocket PC Documents. Then move from my Pocket Pc Documents to Pocket PC \windows folder.
- copy tk8.4 & library to Pocket PC root [1]
- add setup-reg.py or somesort - to register python to the pocket pc [2]
- add sitecustomize.py
This is needed since tcl-tk is not included in sys.path:
import sys
sys.path.append('\\Storage Card\\PythonCE Python\\python23.zip\\lib-tk')
We're all set.
Now, scripts with Tkinter doe work, but sometimes the ipaq would start to act up and a reset is necessary. Guess that's not unimaginable, eh? ;)
I tried using easygui.py, but that does not work 100% of the time. I have no idea what went wrong.
I guess more fiddling is necessary. And I guess I have to go learn Tkinter. ..just when I thought I can go the wxPython or pyQT route.
Here are a few screenies:
.. [1]http://tkinter.unpythonic.net/wiki/How_20to_20install_20Tkinter
--[2]:
#
# Setup the registry to allow us to double click on python scripts
#
from _winreg import *
import sys
print "Setting up registry to allow\ndouble clicking of Python files to work"
#
# Create the registry entries for ".py" and ".pyc" extensions
#
for Name in (".py", ".pyc"):
Key = CreateKey(HKEY_CLASSES_ROOT, Name)
SetValue(Key, None, REG_SZ, "Python.File")
CloseKey(Key)
#
# Create HKEY_CLASSES_ROOT\Python.File\Shell\Open\Command = "\Program Files\Python\Lib\Python.exe" "%1"
#
Key = CreateKey(HKEY_CLASSES_ROOT, "Python.File")
for Name in ("Shell","Open","Command"):
New_Key= CreateKey(Key, Name)
CloseKey(Key)
Key = New_Key
SetValue(Key, None, REG_SZ, '"' + sys.executable + '" "%1"')
CloseKey(Key)
import time
time.sleep(5)
Trackback is http://myzope.kedai.com.my/blogs/kedai/66/tbping
w00t, great tips, nice
