|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
py2exe
can anybody show me how to use py2exe.. im new to programing and cant figure it out
![]() |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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 04:25 PM. |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
|||
|
|||
|
livewires
Quote:
the livewires module came from www.livewires.org.uk |
|
#6
|
|||
|
|||
|
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 ![]() |
|
#7
|
||||
|
||||
|
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 07:02 PM. Reason: Livewires |
|
#8
|
|||
|
|||
|
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'
|
|
#9
|
||||
|
||||
|
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 ![]()
__________________
*** Experimental Python Markup CGI V2 *** Last edited by Grim Archon : October 18th, 2004 at 07:59 PM. |
|
#10
|
|||
|
|||
|
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 |
|
#11
|
|||
|
|||
|
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? ![]() |
|
#12
|
||||
|
||||
|
Try adding:
raw_input("Press ENTER to finish") ![]() grim |
|
#13
|
|||
|
|||
|
odd..... it works for the .py file, but not for the .exe file
![]() |
|
#14
|
||||
|
||||
|
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 r |