Python Forum
Programming Python as a MS Windows app?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming Python as a MS Windows app?
#1
Is it possible to create a Python program that I can click on just like my other Microsoft Windows applications on my desktop?
Any program that I write in Python needs me to go to the dos prompt to run the program so it would be nice to be able to put the Python created program on my desktop and be able to click on it to run the program. Can this be done?

Brian123
Reply
#2
Sure. Using a simple bat file, you can do anything you could do from the command line. If you don't want a command prompt to pop open when you run it, you could use something like py2exe or pyinstaller to create an executable. But those are packaging things, and not useful if your program is still under construction.
Reply
#3
Yes it's possible, you can use cx_freeze
Reply
#4
(Oct-10-2018, 05:14 AM)Yoriz Wrote: Yes it's possible, you can use cx_freeze
Good to know thanks. I must test cx_Freeze. I hope it's freeware.

Now that I have installed cx_Freeze, how do I use it to turn a python script into exe code?
Reply
#5
it's not just cx_freeze. There are also other tools, like pyinstaller.
Also probably the easiest (i.e. no need to convert to exe) is to create shortcut to your python interpreter. Then edit the properties of the shortcut and add the full path to your script in the Target field:
   
In this case you will need to ask user to press a key at the end of the script because otherwise the CommandPrompt window will close automatically when the script execution ends.
Finally, if you wish to make *real* GUI program you need to look at some of the GUI packages. Tkinter comes is included in Windows distributions bu there are others/better ones
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#6
(Oct-10-2018, 05:46 AM)Brian123 Wrote:
(Oct-10-2018, 05:14 AM)Yoriz Wrote: Yes it's possible, you can use cx_freeze
Good to know thanks. I must test cx_Freeze. I hope it's freeware.

Now that I have installed cx_Freeze, how do I use it to turn a python script into exe code?

I managed to find some info on how to use cxFreeze. I need to find a while so it is part of the system. I can't remember how I made Python part of the system so it is reconsidered when I type "python" at the prompt. At the moment if I type cxFreeze at the dos prompt I get a message that DOS doers not know this program. Any help would be great to get me on to the next step thanks.

Brian
Reply
#7
If you installed it through pip, it should already work from the command line. If you didn't install it through pip, then you should.
Reply
#8
(Oct-10-2018, 06:37 AM)buran Wrote: it's not just cx_freeze. There are also other tools, like pyinstaller. Also probably the easiest (i.e. no need to convert to exe) is to create shortcut to your python interpreter. Then edit the properties of the shortcut and add the full path to your script in the Target field: [attachment=480] In this case you will need to ask user to press a key at the end of the script because otherwise the CommandPrompt window will close automatically when the script execution ends. Finally, if you wish to make *real* GUI program you need to look at some of the GUI packages. Tkinter comes is included in Windows distributions bu there are others/better ones
It would be nice to be able to send someone a program that I have written so they can use it on their computer so cxFreeze might be better as it turns code into exe files. But I might try both. Thanks for the info. Brian
Reply
#9
There must be some way to use cxFreeze.
If you have installed this program then what did you type in to use this program?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming robots using Python OscarBoots 5 3,421 Oct-31-2021, 09:38 AM
Last Post: Larz60+
  Programming Difficult math in Python Huntern 6 4,752 Oct-17-2019, 06:32 AM
Last Post: Huntern
  Inconsistency in Python programming language? newbieAuggie2019 31 11,353 Oct-06-2019, 03:21 PM
Last Post: adt
  Python Programming Projects for Beginners jack_sparrow007 3 3,309 Dec-26-2018, 07:52 PM
Last Post: micseydel
  Help with Python programming mediaos 5 3,740 Aug-08-2018, 01:02 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020