October 16th, 2004, 02:26 PM
-
py2exe
can anybody show me how to use py2exe.. im new to programing and cant figure it out
October 16th, 2004, 03:05 PM
-
Sure, if you attach/post your program here then we can see what needs to be done. Though the first thing you'll need to do is download and install it.
Mark.
October 16th, 2004, 03:19 PM
-
Code:
from livewires import *
right=0
wrong=0
for x in range(10):
first_number=random_between(1,10)
second_number=random_between(1,10)
print "first number is %d and second number is %d" % (first_number, second_number)
question = "What is %d * %d? " % (first_number, second_number)
quotent=first_number*second_number
if read_number(question)==quotent:
print 'good job'
right=right + 1
else:
print 'no try again'
wrong=wrong + 1
print ' '
print ' '
if right == wrong:
print 'you got 50%'
elif right == 1:
print 'you got 10%'
elif right == 2:
print 'you got 20%'
elif right == 3:
print 'you got 30%'
elif right == 4:
print 'you got 40%'
elif right == 6:
print 'you got 60%'
elif right == 7:
print 'you got 70%'
elif right == 8:
print 'you got 80%'
elif right == 9:
print 'good job you got 90%'
elif right == 10:
print 'wow nice job you got 100%'
elif right == 0:
print 'you got 0% try again'
print 'you got', right,'right and', wrong,'wrong'
thers my prog. very simple. i made it for my aunt (shes a teacher) to give to her students on the comp as a test or somthing
anyway.. i do have py2exe
thanks for the help
Last edited by netytan; October 16th, 2004 at 03:25 PM.
October 16th, 2004, 03:29 PM
-
This could be me being stupid
. But where did the livewires module come from, I usually start this kind of thing by testing the program to see if it works but without the module I'm kinda stumped.
Oh, also, could you read the thread regarding how to ask a question located at the top of this forum
.
Mark.
October 16th, 2004, 04:22 PM
-
livewires
Originally Posted by netytan
This could be me being stupid

. But where did the livewires module come from, I usually start this kind of thing by testing the program to see if it works but without the module I'm kinda stumped.
Mark.
the livewires module came from www.livewires.org.uk
October 16th, 2004, 04:29 PM
-
here we go
and about the how to thing... sorry im new to forums 
so here we go
Code:
from livewires import *
right=0
wrong=0
for x in range(10):
first_number=random_between(1,10)
second_number=random_between(1,10)
print "first number is %d and second number is %d" % (first_number, second_number)
question = "What is %d * %d? " % (first_number, second_number)
quotent=first_number*second_number
if read_number(question)==quotent:
print 'good job'
right=right + 1
else:
print 'no try again'
wrong=wrong + 1
print ' '
print ' '
if right == wrong:
print 'you got 50%'
elif right == 1:
print 'you got 10%'
elif right == 2:
print 'you got 20%'
elif right == 3:
print 'you got 30%'
elif right == 4:
print 'you got 40%'
elif right == 6:
print 'you got 60%'
elif right == 7:
print 'you got 70%'
elif right == 8:
print 'you got 80%'
elif right == 9:
print 'good job you got 90%'
elif right == 10:
print 'wow nice job you got 100%'
elif right == 0:
print 'you got 0% try again'
print 'you got', right,'right and', wrong,'wrong'
im using python 2.3 on win XP
there we go thats better
October 16th, 2004, 05:47 PM
-
It's not a problem
. Everyone has to be a newbie at some point. Anyway, in the simplest case your setup.py file should look something like:
Code:
from distutils.core import setup
import py2exe
setup(console = ['programname.py'], py_modules = ['livewires'])
Lets continue this in the morning ok
, but first, is this the module in question?
http://eric_rollins.home.mindspring.com/introProgramming/livewires/livewires.py
Take care,
Mark.
Last edited by netytan; October 16th, 2004 at 06:02 PM.
Reason: Livewires
October 18th, 2004, 06:02 PM
-
hm..
hm... when i put in that code(thx by the way),in the begining of the program(takeing out what i had before) and saved it it saved as a unrecognized file and asked me how to open it...
heres the new code just incase you want it
Code:
from distutils.core import setup
import py2exe
setup(console = ['times2.py'], py_modules = ['livewires'])
from livewires import *
right=0
wrong=0
for x in range(10):
first_number=random_between(1,10)
second_number=random_between(1,10)
print "first number is %d and second number is %d" % (first_number, second_number)
question = "What is %d * %d? " % (first_number, second_number)
quotent=first_number*second_number
if read_number(question)==quotent:
print 'good job'
right=right + 1
else:
print 'no try again'
wrong=wrong + 1
print ' '
print ' '
if right == wrong:
print 'you got 50%'
elif right == 1:
print 'you got 10%'
elif right == 2:
print 'you got 20%'
elif right == 3:
print 'you got 30%'
elif right == 4:
print 'you got 40%'
elif right == 6:
print 'you got 60%'
elif right == 7:
print 'you got 70%'
elif right == 8:
print 'you got 80%'
elif right == 9:
print 'good job you got 90%'
elif right == 10:
print 'wow nice job you got 100%'
elif right == 0:
print 'you got 0% try again'
print 'you got', right,'right and', wrong,'wrong'
October 18th, 2004, 06:56 PM
-
Make sure you have this script in the same directory as prog.py (your program) and livewires.py. The double click this file to execute it. The script will create build and dist directories. Your excutable will be in the dist directory.
Code:
from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")
setup(console = [{"script": 'prog.py'}])
You can of course change prog.py for whatever name you called your script.
This is possibly the most minimal setup script for a console app.
[I know it works - I was bored enough to download livewires and test it
]
grim
Last edited by Grim Archon; October 18th, 2004 at 06:59 PM.
October 18th, 2004, 08:24 PM
-
Woohoo
WOOHP DE DOO thx i *finnaly* got it
Thx alot you guys 
i think the problem was that i saved it as file. whatever it wanted not file.py
i feel noobish(tho i am
) anyway thanks alot
October 19th, 2004, 06:02 PM
-
Doh
AWW MAN just when i thought i had this down... my .exe file closes before the user can read the last remarkes printed
can you help?
October 20th, 2004, 01:33 AM
-
Try adding:
raw_input("Press ENTER to finish")
grim
October 20th, 2004, 05:49 PM
-
odd..... it works for the .py file, but not for the .exe file
October 21st, 2004, 02:54 AM
-
Actually In my experiance we get this with all Python programs; .py files or .exe's. If you seach the forum you should see a few threads that discribe the use of raw_input() for this end
.
It's a little anoying at first, but when you remember that they are command line applications it makes sence that they just run right the way though. In-fact it could pretty get anoying if you had to press enter every time you finished running a script just to get to the next command prompt
.
Mark.
October 24th, 2004, 12:30 PM
-
i know!
ill ask the person do you wanna play again? and it wont quit untill they say no
im so smart