Re: Running Python program without getting Python CE window

Ed Blake <[email protected]>
Newsgroups gmane.comp.python.windows-ce
Message-ID <[email protected]>
--- "Michael Foord" <[email protected]> wrote:

> You ought to check out Wax. It's a friendly Pythonic layer that sits 
> atop of wx and IMHO is just as easy to use as Tkinter.

Lol! I've been using/tinkering with firedrop for a few weeks now so I am
vaguely familier with wax.  I don't really like the idea of using a largish
wrapper over the top of a huge library though, especially on a small embedded
device!  Also wax is incomplete, and as I've said I don't know enough Wx to
fix/add stuff.

BTW in Firedrop my page template was failing because the editor I was using
inserted tabs instead of spaces.  I didn't really feel like fixing my
template so I poked around in embedded_code.py.  If you add ".replace('\t','
')" to the return statement in replace_separators tabs vs. spaces becomes a
non-issue ^_^


--- Luke Dunstan <[email protected]> wrote:

> 
> 
> You could make .pyw work on WinCE by creating a key HKCR\.pyw and another 
> like HKCR\Python.File.NoShell, with the appropriate command line. In fact I
> 
> may do this in the next version of the PythonCE installer.
> ...

Hope you don't mind, attached is my hacked version of setup-registry.py which
registers ".pyw", and adds the PythonCE icon to all Python files!  It can
also be found here:
http://kitsu.petesdomain.com/files/WinCE/setup-registry.py

I haven't tested it yet!  My ipaq is out of commission for a while because I
needed its SD card -_-

_______________________________________________
PythonCE mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pythonce
setup-registry.py (text/x-python, 1.6 KB)
#
#	Setup the registry to allow us to double click on python scripts
#
from _winreg import *

print "Setting up registry to allow\nrunning of Python files."

#
#	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 the registry entry for ".pyw" extension
#
Key = CreateKey(HKEY_CLASSES_ROOT, ".pyw")
SetValue(Key, None, REG_SZ, "Python.File.Noconsole")
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, "\"\\Storage Card\\python\\lib\\Python.exe\" \"%1\"")
CloseKey(Key)

print "Setting up registry to allow\ndouble clicking of Python files to work"

#
#	Create command key for nopcceshell (.pyw files)
#
Key = CreateKey(HKEY_CLASSES_ROOT, "Python.File.Noconsole")
for Name in ("Shell","Open","Command"):
  New_Key= CreateKey(Key, Name)
  CloseKey(Key)
  Key = New_Key
SetValue(Key, None, REG_SZ, "\"\\Storage Card\\python\\lib\\Python.exe /nopcceshell\" \"%1\"")
CloseKey(Key)

#
#	Create keys for DefaultIcon
#
icon_path = "\\Storage Card\\python\\lib\\python.exe,0"
for name in ("Python.File", "Python.File."):
    Key = CreateKey(HKEY_CLASSES_ROOT, name)
    New_Key = CreateKey(Key, "DefaultIcon")
    SetValue(New_Key, None, REG_SZ, icon_path)
    CloseKey(Key)
    CloseKey(New_Key)
print 'Icon set to %s' %icon_path

import time
time.sleep(5)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.