Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2010-03-14 12:25:28

bossk171
Member
Registered: 2007-07-16
Posts: 301

Python: moving on up?

I've been using Python for a while now (and loving it) but I want to take my programs to the next level. Bear with while I try to explain myself, I've never taken a programming class, so I don't know how to explain myself properly.

I think what I'm asking about is a GUI, but I'm not sure. I want my programs to be usable by someone without that person having to open up the Python IDE (PyScripter or IDLE in my case) and run the code. I want my program to look like something I might download off the internet (like GraphCalc or Gimp, but not so fancy).

So my questions are:
1. Am I making myself clear?
2. Is this what a GUI is?
3. Can I do this using only Freeware (I'm a poor, simple, college student)
4. Can anyone help me get going on this?

Thanks.


There are 10 types of people in the world, those who understand binary, those who don't, and those who can use induction.

Offline

#2 2010-03-15 14:14:38

calccrypto
Member
Registered: 2010-03-06
Posts: 96

Re: Python: moving on up?

i think what you are asking for is a complier. python complies programs when you import them, but you still need python to run them. you can try "cx_freeze" to compile your programs (and add an icon pic), but they still need python to run them. i dont think you cant simply make an app or something and expect it to run on someone else's computer. ive tried, but nothing works, so far

and why do you need IDLE? cant you just run the scripts in cmd or double clicking the file?


Visit calccrypto.wikidot.com for detailed descriptions of algorithms and other crypto related stuff (not much yet, so help would be appreciated).

Offline

#3 2010-03-15 14:34:19

Ricky
Moderator
Registered: 2005-12-04
Posts: 3,791

Re: Python: moving on up?

calccrypto, you got a half of what he is asking.

There are two parts to making a program look like something "I might download off the internet":

1. Run natively (i.e. an executable)
2. Graphic user interface (GUI)

For the first, it all depends upon which implementation of Python you are using.  If you are using it as a scripting language (e.g. the implementation CPython), then the short answer is: No.   Scripting languages, by definition, require an interpreter to run the code.  This is what I believe you're doing.

But Python is also implemented as a compiled language: you compile code into an executable that you can then run on the machine itself.  Jython is one example of such an implementation.  It actually takes Python code, compiles it into Java byte code, and then you can use that on a machine.  If you go this route, then you can actually use Java GUI libraries to make a GUI.

For the second, you need an external library to interact with the operating system's graphical API.  For Python, check out this site.


"In the real world, this would be a problem.  But in mathematics, we can just define a place where this problem doesn't exist.  So we'll go ahead and do that now..."

Offline

#4 2010-03-16 11:45:10

bossk171
Member
Registered: 2007-07-16
Posts: 301

Re: Python: moving on up?

Calccrypto: I don't understand your question. I use IDLE to write my programs (and more recently PyScriptor). Make no mistake, I have no idea what I'm doing, I'm doing this for fun.

Ricky: Wow, that's a whole bunch of techno-lingo, but at least I have a starting place. Am I going to have to learn Java to use Jython? How do I figure out which implementation of Python I'm using? IF I'm using the wrong implementation of Python, how do I use the right one? And how will that change what I'm doing?


There are 10 types of people in the world, those who understand binary, those who don't, and those who can use induction.

Offline

#5 2010-03-16 13:05:52

Ricky
Moderator
Registered: 2005-12-04
Posts: 3,791

Re: Python: moving on up?

Am I going to have to learn Java to use Jython?

Have to?  No.  But knowing more can never hurt, only help.  You will however have to familiarize yourself with using Jython, which is not the same as learning Java.

How do I figure out which implementation of Python I'm using?

When you go to run python code, what is the name of the program you need to load up first?

how do I use the right one? And how will that change what I'm doing?

The "right" one depends on your needs.  Java is fairly easy to learn and quick to make GUIs.  This is one reason I would recommend Jython.  Start here to use it.  I can offer at least some assistance, but their mailing list would probably be more helpful (use the "users" one).

As for changing what you are doing, there are two large paradigms when it comes to programming (there are others, mind you).  Each of these are not the whole story, but the bigger picture is here:

1. Code -> Compile -> Assembly code -> Assemble -> Machine code -> Run on computer.
2. Code -> Run interpreter -> Load code -> Run on computer

The first is called a "compiled" language, the second a "scripted" language.  The compiled code needs no external programs to run (most of the time...), while scripted code must be run using a program.


"In the real world, this would be a problem.  But in mathematics, we can just define a place where this problem doesn't exist.  So we'll go ahead and do that now..."

Offline

#6 2010-03-20 16:43:56

bossk171
Member
Registered: 2007-07-16
Posts: 301

Re: Python: moving on up?

When I use Python, I use IDLE or PyScripter. I don't compile my code, so I guess I'm using a scripted language.

I look forward to someday learning Java, but I simply don't have the time right now. But if I don't have to learn it to use Jython, I can jump right into no problem.

What are typical "needs" of a compiled/scripted language?


There are 10 types of people in the world, those who understand binary, those who don't, and those who can use induction.

Offline

#7 2012-09-06 14:46:11

Agnishom
Real Member
From: The Complex Plane
Registered: 2011-01-29
Posts: 17,987
Website

Re: Python: moving on up?

I think you can
There are a lot of GUI modules in Python
E.g, Tkinter


'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
'You have made another human being happy. There is no greater accomplishment.' -bobbym

Offline

Board footer

Powered by FluxBB