Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 16th, 2004, 03:26 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
py2exe

can anybody show me how to use py2exe.. im new to programing and cant figure it out

Reply With Quote
  #2  
Old October 16th, 2004, 04:05 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old October 16th, 2004, 04:19 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
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.

Reply With Quote
  #4  
Old October 16th, 2004, 04:29 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to 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.

Oh, also, could you read the thread regarding how to ask a question located at the top of this forum .

Mark.

Reply With Quote
  #5  
Old October 16th, 2004, 05:22 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
livewires

Quote:
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

Reply With Quote
  #6  
Old October 16th, 2004, 05:29 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
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

Reply With Quote
  #7  
Old October 16th, 2004, 06:47 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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

Reply With Quote
  #8  
Old October 18th, 2004, 07:02 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
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'

Reply With Quote
  #9  
Old October 18th, 2004, 07:56 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
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.

Reply With Quote
  #10  
Old October 18th, 2004, 09:24 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
Talking 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

Reply With Quote
  #11  
Old October 19th, 2004, 07:02 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
Unhappy 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?

Reply With Quote
  #12  
Old October 20th, 2004, 02:33 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
Try adding:
raw_input("Press ENTER to finish")

grim

Reply With Quote
  #13  
Old October 20th, 2004, 06:49 PM
amoo3 amoo3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 363 amoo3 User rank is Private First Class (20 - 50 Reputation Level)amoo3 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 2 h 37 m 38 sec
Reputation Power: 5
odd..... it works for the .py file, but not for the .exe file

Reply With Quote
  #14  
Old October 21st, 2004, 03:54 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 11 m 13 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
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