Thread: CMD Box on .exe

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2005
    Location
    West Sussex
    Posts
    25
    Rep Power
    0

    Red face CMD Box on .exe


    Hey again, firstly i want to say sorry if I'm bugging you by posting over and over, although i do try and research my stuff first.

    I have created a python program and saved it as a .pyw so then when i click/run the script it just runs the program without the Command Prompt box appearing, but when i got to turn it into a .exe using PY2EXE whenever i run the .exe it still opens up a Command Prompt box, isn't there a way to get rid of it when its in the form of an .exe ??? OK Thanks for the help again

    Oh also another thing, is there a way of making a button in Tkinter that when pressed Minimizes the program (either to the taskbar or to the system tray) as well as the normal minimize button in the top right corner of the program?

    Steve
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    I'm just going to guess that your setup.py (or whatever you named it) looks somewhat as follows:

    Code:
    # setup.py
    from distutils.core import setup
    import py2exe
    
    setup(console=["myscript.py"])
    If this is true, change it to this:

    Code:
    # setup.py
    from distutils.core import setup
    import py2exe
    
    setup(windows=["myscript.py"])
    I'm not very familiar with using Tkinter, but it is possible to minimize in the method you desire. mawe may know how to do this. I'll expect him to respond eventually.

    Comments on this post

    • SteveFerrigno agrees
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2005
    Location
    West Sussex
    Posts
    25
    Rep Power
    0
    Thanks for the help i remember reading that windows did that but never really knew where to put it but that seems good I'm off to bed now so ill try in the morning by then maybe mawe will have either agreed or said something Thank you

    *EDIT*
    Yep, it seemed to work fine thank you very much for the help
  6. #4
  7. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    I am sure Mawe would point you to the iconify method:

    root = Tk()
    Button(root, text='Minimise', command=root.inconify).pack()

    For more info on window management and Tkinter generally have a look here:
    Toplevel Methods

    Have fun.

    grim

IMN logo majestic logo threadwatch logo seochat tools logo