How to create an entry in the "Program menu" of Windows?

D

Diesel

Hi,

I'd like to add menu entry in the Program Menu as part of the
installation of an application. Is it possible to do that from Python?

Any examples or link? I have not been able to find anything with
google...

thanks in advance
s/
 
R

rantingrick

I'd like to add menu entry in the Program Menu as part of the
installation of an application. Is it possible to do that from Python?

Diesel your description is ambiguous at best, might we inquire that
you elaborate a wee bit more? Is this "application" something that YOU
created? If so what GUI library did you use? Can you show us some code
or a small example?
 
M

Michael Torrie

I'd like to add menu entry in the Program Menu as part of the
installation of an application. Is it possible to do that from Python?

Any examples or link? I have not been able to find anything with
google...

Use an installer program like nsis to create an installer package from
your python app. It can do all those kinds of things, and clean up
after the program is uninstalled.
 
A

Alexander Kapps

Hi,

I'd like to add menu entry in the Program Menu as part of the
installation of an application. Is it possible to do that from Python?

Any examples or link? I have not been able to find anything with
google...

thanks in advance
s/

AFAIK, the startmenu entries are just .lnk files, placed either in
the "All Users" or "Some Specific User" Startmenu directory. I only
have a German XP and can't boot it to test at the moment, so I can't
give more details, but there are surely registry entries to find the
Startmenu location for the current user or for "All Users".

See http://codesnippets.joyent.com/posts/show/529 for an example how
to place .lnk files. However, for real deployment, you probably want
to use a real installer framework like NSIS for example.

HTH
 
S

sandro

Alexander said:
AFAIK, the startmenu entries are just .lnk files, placed either in
the "All Users" or "Some Specific User" Startmenu directory. I only
have a German XP and can't boot it to test at the moment, so I can't
give more details, but there are surely registry entries to find the
Startmenu location for the current user or for "All Users".

See http://codesnippets.joyent.com/posts/show/529 for an example how
to place .lnk files. However, for real deployment, you probably want
to use a real installer framework like NSIS for example.

Thanks Alexander, in the meanwhile I also found this [1] message that
reports the following snippet that uses module winshell (and win32...):

[1] http://www.mail-archive.com/[email protected]/msg05411.html

import os, sys
import winshell

startup = winshell.startup () # use common=1 for all users
print startup

winshell.CreateShortcut (
Path=os.path.join (winshell.startup (), "Python.lnk"),
Target=sys.executable,
Icon=(sys.executable, 0),
Description="Python"
)

thanks again
*:)
 
S

Steven D'Aprano

Hi,

I'd like to add menu entry in the Program Menu as part of the
installation of an application. Is it possible to do that from Python?

Of course. Python is Turing complete, if any language can do it, Python
can too (although not necessarily as fast or easily).

What operating system and desktop environment are you using? For example,
under KDE 3.x, you would choose which Program menu you want to use
(Utilities, Office, Internet, Multimedia, etc.), decide whether you want
this to apply to all users or just a single user, and then create the
appropriate .desktop files. In my not-so humble opinion, it's a mess, but
for what it's worth there's a description of it here:

http://humanreadable.nfshost.com/howtos/kde-menus.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top