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

Discussion in 'Python' started by Diesel, Feb 1, 2011.

  1. Diesel

    Diesel Guest

    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/
     
    Diesel, Feb 1, 2011
    #1
    1. Advertising

  2. Diesel

    rantingrick Guest

    On Feb 1, 3:43 pm, Diesel <> wrote:

    > 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?
     
    rantingrick, Feb 1, 2011
    #2
    1. Advertising

  3. On 02/01/2011 02:43 PM, Diesel wrote:
    > 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.
     
    Michael Torrie, Feb 1, 2011
    #3
  4. On 01.02.2011 22:43, Diesel wrote:
    >
    > 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
     
    Alexander Kapps, Feb 1, 2011
    #4
  5. Diesel

    sandro Guest

    Alexander Kapps wrote:

    > On 01.02.2011 22:43, Diesel wrote:
    >>
    >> 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.
    >


    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//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
    *:)
     
    sandro, Feb 2, 2011
    #5
  6. On Tue, 01 Feb 2011 21:43:26 +0000, Diesel wrote:

    > 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



    --
    Steven
     
    Steven D'Aprano, Feb 2, 2011
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    326
  2. Grey
    Replies:
    2
    Views:
    1,120
    Rimu Atkinson
    Feb 10, 2004
  3. AtomicBob
    Replies:
    14
    Views:
    893
    Toby Inkster
    May 2, 2006
  4. Mike Owen

    Allowing entry of a Carriage Return during data entry

    Mike Owen, Jul 27, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    712
    Alessandro Zifiglio
    Jul 27, 2006
  5. Noozer
    Replies:
    2
    Views:
    260
    Dr John Stockton
    Aug 1, 2005
Loading...

Share This Page