[Tutor] Making my program an executable/distributable

paul clanoftheinsane@hotmail.com
Sat, 25 Aug 2001 14:50:57 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C12D75.5927F920
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

> > i have asked this question before, about a week or so ago, but i just
> > want to re-ask it in case anyone missed it.  i have written a python
> > program including Tkinter, and when i used py2exe to convert it to an
> > executable, it called for the riscosenviron, riscos, riscospath, and
> > ce modules.  is this because of my using Tkinter in my script?  does
> > py2exe not support Tkinter?  i'm just curious.  i finally finished my
> > program, and i just want to be able to distribute it.  please help?!?!
> 
> According to the py2exe web site,
> 
>     http://starship.python.net/crew/theller/py2exe/
> 
> py2exe should fully support Tkinter programs.  Let's see... can you show
> us both your script and the Setup.py file you've set up?  I personally
> don't have Windows, but many people on the list do, so one us should be
> able to investigate this.
> 
> Good luck to you!




ok, my files are attached to this email

------=_NextPart_000_0007_01C12D75.5927F920
Content-Type: text/plain;
	name="guifun.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="guifun.py"

from Tkinter import *
import sys
import StringIO

io=3DStringIO.StringIO()
sys.stdout=3Dio

def list():
    global ListFrame
    ListFrame=3DFrame(master, relief=3D"ridge", bd=3D2, height=3D400, =
width=3D300)
    ListFrame.grid(columnspan=3D4, row=3D2, pady=3D3)
    f=3Dopen("C:/python20/forlist.py")
    b=3Df.readlines()
    numberOfBooks=3Dlen(b)
    print "\nBooks:"
    for i in range(0,numberOfBooks):
        e=3Db[i].split(',')
        print e[0]
        done=3D1
    io.seek(0)
    t=3DText(ListFrame, height=3D20, width=3D40)
    t.grid()
    t.insert(INSERT, io.read())
    quitButton=3DButton(ListFrame, text=3D"Done", command=3DQuitList)
    quitButton.grid(row=3D1)
    io.seek(2)

def QuitList():
    ListFrame.destroy()

#Book View
def viewABook():
    global ViewFrame
    ViewFrame=3DFrame(master, relief=3D"ridge", bd=3D2, height=3D400, =
width=3D300)
    ViewFrame.grid(columnspan=3D4, row=3D2, pady=3D3)
   =20
    global bookEntry
    bookLabel=3DLabel(ViewFrame, text=3D"Book: ")
    bookLabel.grid(row=3D0, column=3D0)
    bookEntry=3DEntry(ViewFrame, width=3D40)
    bookEntry.grid(row=3D0, column=3D1, columnspan=3D2)
    bookButton=3DButton(ViewFrame, text=3D"Finish", =
command=3DfinishView)
    bookButton.grid(row=3D1, column=3D1)

    quitButton=3DButton(ViewFrame, text=3D"Done", =
command=3DViewFrame.destroy)
    quitButton.grid(row=3D1, column=3D2)
   =20
def finishView():
    bookWanted=3DbookEntry.get()
    f=3Dopen("C:/python20/forlist.py")
    b=3Df.readlines()
    numberOfBooks=3Dlen(b)
    for i in range(0,numberOfBooks):
        e=3Db[i].split(',')
        c=3Dlen(e)
        if bookWanted=3D=3De[0]:
            print """
------------Keywords for: %s
------------Author: %s""" %(e[0], e[1])
            =20
            for i in range(c-3):
                print "-------------", e[i+2].lstrip()
                done=3D1
   =20
#Search Suite
def search():
    global SearchFrame
    SearchFrame=3DFrame(master, relief=3D"ridge", bd=3D2, height=3D400, =
width=3D400)
    SearchFrame.grid(columnspan=3D4, row=3D2, pady=3D3)

    byAuthor=3DButton(SearchFrame, text=3D"By Author", =
command=3DbyAuthorView)
    byTitle=3DButton(SearchFrame, text=3D"By Title", =
command=3DbyTitleView)
    byKeyword=3DButton(SearchFrame, text=3D"By Keyword", =
command=3DbyKeywordView)
    byAuthor.grid(row=3D0, column=3D0, padx=3D3)
    byTitle.grid(row=3D0, column=3D1, padx=3D3)
    byKeyword.grid(row=3D0, column=3D2, padx=3D3)
    Finishbutton=3DButton(SearchFrame, text=3D"Finish Search", =
command=3DallFinish)
    Finishbutton.grid(row=3D0, column=3D3)

def allFinish():
    SearchFrame.destroy()

def byAuthorView():
    global authorEntry
    global authorLabel
    global finishButton
    global quitButton
    authorLabel=3DLabel(SearchFrame, text=3D"Author: ")
    authorLabel.grid(row=3D1, column=3D0)
    authorEntry=3DEntry(SearchFrame, width=3D36)
    authorEntry.grid(row=3D1, column=3D1, columnspan=3D3, pady=3D2)
    finishButton=3DButton(SearchFrame, text=3D"Finish", =
command=3DbyAuthor)
    finishButton.grid(row=3D2, column=3D1)
    quitButton=3DButton(SearchFrame, text=3D"Quit", =
command=3DbyAuthorQuit)
    quitButton.grid(row=3D2, column=3D2)                     =20

def byAuthor():
    authWanted=3DauthorEntry.get()
    f=3Dopen("C:/python20/forlist.py")
    b=3Df.readlines()
    numberOfBooks=3Dlen(b)
    for i in range(0,numberOfBooks):
        e=3Db[i].split(',')
        c=3Dlen(e)
        if authWanted=3D=3De[1]:
            print "\n-------Author: ",e[1]
            print "---------Book: ",e[0]
            for i in range (c-3):
                print "-----Keywords: ",e[i+2]
                authorEntry.delete(0,40)
                done=3D1

def byAuthorQuit():
    authorEntry.destroy()
    authorLabel.destroy()
    finishButton.destroy()
    quitButton.destroy()
   =20
def byTitleView():
    global titleEntry
    global titleLabel
    global finishButton
    global quitButton
    titleLabel=3DLabel(SearchFrame, text=3D"Title: ")
    titleLabel.grid(row=3D1, column=3D0)
    titleEntry=3DEntry(SearchFrame, width=3D36)
    titleEntry.grid(row=3D1, column=3D1, columnspan=3D3, pady=3D2)
    finishButton=3DButton(SearchFrame, text=3D"Finish", =
command=3DbyTitle)
    finishButton.grid(row=3D2, column=3D1)
    quitButton=3DButton(SearchFrame, text=3D"Quit", =
command=3DbyTitleQuit)
    quitButton.grid(row=3D2, column=3D2)

def byTitle():
    titleWanted=3DtitleEntry.get()
    f=3Dopen("C:/python20/forlist.py")
    b=3Df.readlines()
    numberOfBooks=3Dlen(b)
    for i in range(0,numberOfBooks):
        e=3Db[i].split(',')
        c=3Dlen(e)
        if titleWanted=3D=3De[0]:
            print "\n-------Author: ",e[1]
            print "---------Book: ",e[0]
            for i in range (c-3):
                print "-----Keywords: ",e[i+2]
                done=3D1

def byTitleQuit():
    titleEntry.destroy()
    titleLabel.destroy()
    finishButton.destroy()
    quitButton.destroy()

def byKeywordView():
    global keywordEntry
    global keywordLabel
    global finishButton
    global quitButton
    keywordLabel=3DLabel(SearchFrame, text=3D"Keyword: ")
    keywordLabel.grid(row=3D1, column=3D0)
    keywordEntry=3DEntry(SearchFrame, width=3D36)
    keywordEntry.grid(row=3D1, column=3D1, columnspan=3D3, pady=3D2)
    finishButton=3DButton(SearchFrame, text=3D"Finish", =
command=3DbyKeyword)
    finishButton.grid(row=3D2, column=3D1)
    quitButton=3DButton(SearchFrame, text=3D"Quit", =
command=3DbyKeywordQuit)
    quitButton.grid(row=3D2, column=3D2)

def byKeyword():
    kwWanted=3DkeywordEntry.get()
    f=3Dopen("C:/python20/forlist.py")
    b=3Df.readlines()
    numberOfBooks=3Dlen(b)
    for i in range(0,numberOfBooks):
        e=3Db[i].split(',')
        c=3Dlen(e)
        if kwWanted in e[2:]:
            print "\n-------Author: ",e[1]
            print "---------Book: ",e[0]
            for i in range (c-3):
                print "-----Keywords: ",e[i+2]
                done=3D1

def byKeywordQuit():
    keywordEntry.destroy()
    keywordLabel.destroy()
    finishButton.destroy()
    quitButton.destroy()
   =20
#Add an Entry
def addview():
    global AddFrame
    AddFrame=3DFrame(master, relief=3D"ridge", bd=3D2, height=3D400, =
width=3D300)
    AddFrame.grid(columnspan=3D4, row=3D2, pady=3D3)

    global authorLabel
    global titleLabel
    global keywordLabel

    authorLabel=3DLabel(AddFrame, text=3D"Author: ")
    titleLabel=3DLabel(AddFrame, text=3D"Title: ")
    keywordLabel=3DLabel(AddFrame, text=3D"Keywords: ")
    authorLabel.grid(row=3D1, column=3D0, pady=3D2)
    titleLabel.grid(row=3D2, column=3D0)
    keywordLabel.grid(row=3D3, column=3D0)

    global authorEntry
    global titleEntry
    global keywordEntry

    authorEntry=3DEntry(AddFrame, width=3D37)
    titleEntry=3DEntry(AddFrame, width=3D37)
    keywordEntry=3DEntry(AddFrame, width=3D37)
    authorEntry.grid(row=3D1, column=3D1, columnspan=3D3)
    titleEntry.grid(row=3D2, column=3D1, columnspan=3D3)
    keywordEntry.grid(row=3D3, column=3D1, columnspan=3D3)

    enterButton=3DButton(AddFrame, text=3D"Add Book", command=3Dadd)
    enterButton.grid(row=3D4, column=3D2)

    quitButton=3DButton(AddFrame, text=3D"Done", command=3DaddQuit)
    quitButton.grid(row=3D4, column=3D3)

def add():
    title=3DtitleEntry.get()
    author=3DauthorEntry.get()
    keyword=3DkeywordEntry.get()
    a=3Dkeyword.split(',')
    b=3Dlen(a)
    for i in range(b):
        a[i].strip()
    f=3Dopen("C:/Python20/forlist.py", 'a')
    f.write("%s,%s," %(title, author))
    for i in range(b):
        f.write("%s," %(a[i]))
    f.write("\n")
    titleEntry.delete(0,37)
    authorEntry.delete(0,37)
    keywordEntry.delete(0,37)

def addQuit():
    AddFrame.destroy()

#About the Application
def about():
    bottomFrame=3DFrame(master, relief=3D"ridge", bd=3D3, height=3D400, =
width=3D300)
    bottomFrame.grid(row=3D2, pady=3D3)
    global AboutFrame
    AboutFrame=3DFrame(master, relief=3D"ridge", bd=3D2, height=3D400, =
width=3D300)
    AboutFrame.grid(columnspan=3D4, row=3D2, pady=3D3)
    aboutLabel1=3DLabel(AboutFrame, text=3D"BookDB version 0.6")
    aboutLabel2=3DLabel(AboutFrame, text=3D"Developed by Paul Brown")
    aboutLabel1.grid()
    aboutLabel2.grid()
    aboutQuitButton=3DButton(AboutFrame, text=3D"Quit", =
command=3DaboutQuit)
    aboutQuitButton.grid()

def aboutQuit():
    AboutFrame.destroy()

master=3DTk()
master.geometry('500x450')

newFrame=3DFrame(master, relief=3D"ridge", bd=3D3)
newFrame.grid(pady=3D2, row=3D0)
HruleFm=3DFrame(master, relief=3D"ridge", bd=3D1, height=3D3, =
width=3D500)
HruleFm.grid(row=3D1)

ListButton=3DButton(newFrame, text=3D"List Books", command=3Dlist)
ListButton.grid(column=3D0, row=3D0, pady=3D1, padx=3D1)
KeywordButton=3DButton(newFrame, text=3D"Book Keywords", =
command=3DviewABook)
KeywordButton.grid(column=3D1, row=3D0, pady=3D1, padx=3D1)
SearchButton=3DButton(newFrame, text=3D"Search", command=3Dsearch)
SearchButton.grid(column=3D2, row=3D0, pady=3D1, padx=3D1)
AddButton=3DButton(newFrame, text=3D"Add Entry", command=3Daddview)
AddButton.grid(column=3D3, row=3D0, pady=3D1, padx=3D1)
AboutButton=3DButton(newFrame, text=3D"About BookDB", command=3Dabout)
AboutButton.grid(column=3D4, row=3D0, pady=3D1, padx=3D1)
ExitButton=3DButton(newFrame, text=3D"Exit Program", =
command=3Dmaster.destroy)
ExitButton.grid(column=3D5, row=3D0)

bottomFrame=3DFrame(master, relief=3D"ridge", bd=3D3, height=3D400, =
width=3D300)
bottomFrame.grid(row=3D2, pady=3D3)

------=_NextPart_000_0007_01C12D75.5927F920
Content-Type: text/plain;
	name="setup.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="setup.py"

from distutils.core import setup
import py2exe

setup(name="BookDB",
    scripts=["guifun.py"])

------=_NextPart_000_0007_01C12D75.5927F920--