[Tutor] Re: Tutor Digest, Vol 11, Issue 29

Jim Kelly jkmacman at yahoo.com
Mon Jan 10 01:03:25 CET 2005


i had the same probblem with xp.

on mac os x i can double click on the file and it will
open.


xp opens the python file and closes it immediately
apon double click


open the python file via the Start Menu in xp.


Then hit f5 and the script will run


jk
nj
--- tutor-request at python.org wrote:

> Send Tutor mailing list submissions to
> 	tutor at python.org
> 
> To subscribe or unsubscribe via the World Wide Web,
> visit
> 	http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body
> 'help' to
> 	tutor-request at python.org
> 
> You can reach the person managing the list at
> 	tutor-owner at python.org
> 
> When replying, please edit your Subject line so it
> is more specific
> than "Re: Contents of Tutor digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: (no subject) (Alan Gauld)
>    2. Crossword program (David Holland)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Sun, 9 Jan 2005 15:33:28 -0000
> From: "Alan Gauld" <alan.gauld at freenet.co.uk>
> Subject: Re: [Tutor] (no subject)
> To: "Jeffrey Thomas Peery" <jeffpeery at yahoo.com>,
> <tutor at python.org>
> Message-ID: <001a01c4f660$91848150$16c68651 at xp>
> Content-Type: text/plain;	charset="iso-8859-1"
> 
> 
> > Hello I can't seem to get the IDLE to start up in
> my windows XP by
> clicking
> > ...
> > Also I can't seem to get xp to recognize .py files
> belonging to
> python.
> 
> This is all fixable but it suggests maybe other
> problems in the
> installation. Personally I'd recommend reinstalling
> Python
> and that should fix all the problems.
> 
> Alan G.
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Sun, 9 Jan 2005 21:44:03 +0000 (GMT)
> From: David Holland <davholla2002 at yahoo.co.uk>
> Subject: [Tutor] Crossword program
> To: tutor at python.org
> Message-ID:
>
<20050109214403.98143.qmail at web25407.mail.ukl.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
> 
> I wrote a program to create crosswords in python.
> It is not perfect but it works, is there any open
> source place I can put this for it to be used by
> anyone who wants it ?  (Subject to the gpl licence).
> Here is the code in case anyone is interested.
> 
> from Tkinter import *
> #Crossword program David Holland
> class Crossword(Frame):
> 
>     def __init__(self, master):
>         '''Default arguments'''
>         Frame.__init__(self, master)
>         self.grid()
>         self.create_widgets()
>         NUM_SQUARES = 169
>         EMPTY = " "
>         global questionanswer
>         questionanswer = {}
>         global dictshort
>         dictshort = {}
>         
>     def readdict(self):
>         #get the dictionary from a file
>         try:
>             pickle_file = open(dictfile, "rb")
>             dictread = cPickle.load(pickle_file)
>         except:
>             dictread = {}
>         return dictread
> 
>     def writedict(self, dictent):
>         #write dictionary to file
>         pickle_file = open(dictfile, "wb")
>         cPickle.dump(dictent, pickle_file)
>         pickle_file.close()
> 
>     def showclues(self):
>         #show clues on the screen
>         questionanswer = self.readdict()
>         textent = self.showinfo(questionanswer)
>         #textent = questionanswer
>         self.putinfo(textent)
> 
>     def showinfo(self, dictent):
>         #make the clues look readable
>         i = 0
>         listkeys = dictent.keys()
>         #listkeys = listkeys.sort()
>         textdisp = ''
>         for item in listkeys:
>             i = i+1
>             istr = str(i) + " "
>             question = dictent[item]
>             textdisp = textdisp + istr + " the
> question is " + question + " the answer is " + item
> +
> "\n"
>         return textdisp
>     
>     def newcrosswordboard(self):
>         #create a crossword board
>         board = []
>         for square in range (NUM_SQUARES):
>             board.append(EMPTY)
>         return board
>     
> #    def newcrosswordboard(self):
> #        #this is create a board with the numbers
> #        board = []
> #        for square in range (NUM_SQUARES):
> #            text = str(square)
> #            board.append(text)
> #        return board
> 
>     def deleteclue(self):
>         #delete a clue
>         try:
>             numberentered = self.delete_ent.get()
>             dictent = self.readdict()
>             numberentered = int(numberentered)
>             listkeys = dictent.keys()
>             i = 1
>             clue = ''
>             for item in listkeys:
>                 if numberentered == i:
>                     del dictent[item]
>                     clue = item
>                     break
>                 i = i +1
>             text = "Clue " + clue + " has been
> removed
> the list of clues now is :-" + "\n"
>             self.writedict(dictent)
>             moretext = self.showinfo(dictent)
>             text = text + moretext
>         except:
>             text = "Please enter a number as a
> figure"
>         self.putinfo(text)
>             
>     def create_widgets(self):
>         #create GUI
>         self.question_lbl = Label(self, text =
> "Enter
> the question ")
>         self.question_lbl.grid(row = 0, column = 0,
> columnspan = 2, sticky = W)
>         self.answer_lbl = Label(self, text = "Enter
> the answer")
>         self.answer_lbl.grid(row = 1, column = 0,
> columnspan = 2, sticky = W)
>         self.delete_lbl = Label(self, text = "Enter
> the number of a clue you want deleted")
>         self.delete_lbl.grid(row = 2, column = 0,
> columnspan = 2, sticky = W)
>          #entry widget for the question
>         self.question_ent = Entry(self)
>         self.question_ent.grid(row=0, column = 2,
> columnspan = 1, sticky = W)
>         self.answer_ent = Entry(self)
>         self.answer_ent.grid(row=1, column = 2,
> columnspan = 2, sticky = W)
>         self.delete_ent = Entry(self)
>         self.delete_ent.grid(row=2, column = 2,
> columnspan = 1, sticky = W)
>         
>         #button to add entries
>         Button(self, text = "Click to add clues ",
> command = self.create_questionsanswer).grid(row = 0,
> column = 3, columnspan = 3)
>         Button(self, text = "Click to show clues ",
> command = self.showclues).grid(row = 1, column = 3,
> columnspan = 3)
>         Button(self, text = "Click to delete clue ",
> command = self.deleteclue).grid(row = 2, column = 3,
> 
=== message truncated ===



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail


More information about the Tutor mailing list