I always see Python for web development but not for desktop programs. I've heard you can but can't find resources on how. Thanks in advance O:)

Recommended Answers

All 18 Replies

No, you can interpret Python code with Python.

You have module like py2exe,cxfreeze,gui2exe that will give you(exe) to run without python installed.
If that what you mean.

If you just have a Windows OS and Python version less than 3.0, you can use a program called py2exe. Here is the poop ...

"""
Py2ExeConSetup.py

Py2Exe (version 6.6 and higher) setup file for a console programs.
Creates a single .exe file.

Simply add this file into the same folder with the source file.
Change your source filename at the bottom to whatever you called your 
code file.  Now run Py2ExeConSetup.py ...

Two subfolders will be created called build and dist.
The build folder is for info only and can be deleted.
Distribute whatever is in the dist folder.
The dist folder contains your .exe file, any data files you specified
in "data_files =", MSVCR71.dll (maybe) and w9xpopen.exe

Your .exe file contains your code as . pyo optimized byte code files, 
all needed modules and the Python interpreter (as a Pythonxx.dll).
MSVCR71.dll can be distributed, but is often already in the system32 
folder or the C:\Windows\SysWOW64 folder on Windows7 (64bit). 
w9xpopen.exe is needed for os.popen() only, can be deleted otherwise.
vegaseat  05may2009
"""

from distutils.core import setup
import py2exe
import sys

sys.argv.append("py2exe")
sys.argv.append("-q")

setup(
  options = {"py2exe": {"compressed": 1,
                        "optimize": 2,
                        "ascii": 1,
                        "bundle_files": 1}},
  zipfile = None,
  # to add .dll or image files use list of filenames
  # these files are added to the dir containing the exe file
  #data_files = [('./images/red.jpg'), ('./images/blue.jpg')],
  # replace 'DateTime1.py' with your own code filename
  # (replace console with windows for a windows program)
  console = [{"script": 'DateTime1.py'}]
)

For Python27 download installer file:
http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe/download

commented: works well +11

So then what is python used for if you can't create dekstop programs?

So then what is python used for if you can't create dekstop programs?

Of course you can create dekstop programs with python,in fact python is very good for that.
You have many good GUI toolkit like wxpython,PyQt,PyGTK.
And the god news for python pyside(no licence problem)
http://www.pyside.org/
You can also use java(swing) and .NET(winform) through python.

Some expample of program using this GUI-toolkit.
VLC(QT)
http://www.videolan.org/vlc/screenshots.html
Wxpython/wxwidgets
Dropbox- TrueCrypt - Digsby

In this link code for all GUI-toolkit.
http://www.daniweb.com/software-development/python/threads/191210

commented: good info +15

So then what is python used for if you can't create dekstop programs?

IMHO, you sound like a person that hasn't even bothered to take a closer look a the Python language. You want to spread your signature spam, go somewhere else!

What exactly is swing and winform? WHat is QT? So your saying those programs that you put the links for were actually made in python and used pyside to compile it? Wow :D

Well I'm looking at studying either Python or C++. I can't decide, so I want to know exactly what I'm getting for my time. I'm more of a person that wants a balance between desktop and web development (and soon mobile too). You judge fast vegaseat -_-

WHat is QT?

QT(first link in google)

python and used pyside to compile it?

Pyside(GUI-toolkit) is a licence free versjon of QT.

You seems not so much uppdatet about this thing,so do a little searching.
Python is an easier language to learn and use than C++,python are used in many areas.
http://www.python.org/about/quotes/

Wow, that's truly amazing :O I have been kinda seeing things that say you can tranfser code to others without exposing the source, is that true? So if you need py2exe to compile code for WIndows, do you need a compiler at all for Mac and/or Linux? Or it runs as a .py format/program?

If I'm going to learn Python, should I go 2 or 3?

Thanks thus far

To hide your exact source file, you can distribute them as compiled Python files (.pyc), py2exe and other packagers will do that for you automatically.

See:
http://www.daniweb.com/software-development/python/threads/20774/139280#post139280

You have to learn and understand the difference between a compiled language like C or C++, and an interpreted language like Python, Java or Ruby.

So languages like Python don't actually compile like C or C++ do? You would have software on the computer that would interpret it? Yet, for windows user, there are compilers (like py2exe) that compile it in .exe for you? Then why do I never see programs come in those formats for Python, Java (I think I may've seen Java in that manner, limewire was compiled right?) or Ruby.

.pyc files run but need the Python IDE to run but the user cannot view the source no-matter what?

Similar to Java, Python takes the source file (.py) and compiles it to a byte code file (.pyc). For speed it happens in memory, but you can make a file ...

# create a byte code compiled python file from a saved source file 
import py_compile 
py_compile.compile("MyPyFile.py")  # creates  MyPyFile.pyc

This byte code is virtual machine code (cross platform) and is then interpreted by the Python interpreter specific for your CPU architecture and OS.

Utilities like py2exe simply package all the byte code files and needed modules and the whole Python interpreter (eg. Python27.dll) into one self-extracting Windows executable .exe file. This way you can distribute your Python program to folks who do not have the Python interpreter installed. Computers with a Unix based operating system usually have Python installed, and you can simple hand them the source code files or the more secretive byte code files.

There is also Portable Python that works from a small USB Flashcard.

An IDE (Integrated Development Environment) is simple an editor you can write your programs with, that can be configured to use the interpreter or compiler you want for your code to run with. Your Python installation will have the IDLE IDE that holds your hands as you write and run your (Python only) code.

IDLE (named after one of the Monty Python actors) can be used in the command mode (Python shell), so you can quickly test short code lines. More commonly you would use the editor mode, write your code, save it to a .py file and then run it from within IDLE.

If I've got an IDE then why do I need IDLE. Did the creator really like Monty Python? Thus, Python is not designed for large scale applications (as I heard it becomes difficult to make and manage larger projects)? Its really only for small projects and things? With the ones compiled to an exe, everytime they're run, they would 'decompile' and run the .pyc with the built in Python27.dll . DOes python creat all those other formats that you would need in programs (.dll, and your own extension files) ?

Does Java work in similar ways, is that how its cross-platform? Does developing sites/web apps in python convert them to the necessary html/css/javascript or something different? Is RUby cross-platform.

What sort of stuff do you create?

Where can I get the portable version, is it would be much better and easier to code in their than having to install it?

Google uses a lot of Python. Google is your friend, so start googling for some of your questions and experience the power of Python.

Many large programs like YouTube, DropBox etc. are written in Python.

C++ and Python complement each other well. Why don't you study C++ first to learn the rigorous approaches to coding and then explore Python.

A nice online tutorial for C++ is here:
[url]http://www.cprogramming.com/tutorial/lesson1.html[/url]

Note:
When you compile your C++ code on Windows than your executable file is only good for machines with the Windows OS.

OK, thanks. But part of me Googling my answers is coming here. How do they compliment eachother? Thanks thus far everyone.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.