woooee 814 Nearly a Posting Maven

At Lunch Time, sit in your parked car with sunglasses on and point a Hair Dryer at passing cars. See if they slow down

woooee 814 Nearly a Posting Maven

I think Pythonbeginner! means something like this: string of letters: 'abcdefgh' list of integers: [(2, 6)], how can you extract the letters from 2-6 (cefg)?

(cefg) what happened to "d".

Can anyone give a clue?

You can access the letters in a string by it's offset (note that the fifth offset is the sixth letter because you skip over the first 5--offest the pointer to after 5--to get to the start of the 6th):

string_of_letters='abcdefgh'
for ctr in range(2, 6):
    print string_of_letters[ctr]
woooee 814 Nearly a Posting Maven

Is "board" a class instance with a function named "game_end" or some other container, as a class instance can not be tested, but only a container in that class can contain moves. Perhaps you should include the end_game function as well as the code that creates the instance of the class board.

def move(self, board, temp_stack):

If board is a class instance with a game_end function, then you are passing the class to this function twice, i.e. self & board, unless board is an instance of a second, different class.

woooee 814 Nearly a Posting Maven
def move(self, board, temp_stack):
            if board.game_end():

What does the function game_end test? Definitely not new_board or new_stack since they are not instance variables and are not passed to the function, so the game_end function is testing some container that does not change. Add a print statement to the function to see what is really happening.

woooee 814 Nearly a Posting Maven

I need a library for a certain script and I don't know which one to choose

What are the options that you are choosing from? This is the Python programming forum for posting programs written in Python. I don't know what you mean by "library", but there is nothing that exists in Python that I know of that already does this. I don't think there is a forum on this site for general questions such as yours, but if you ask on any other forum, here or otherwise, clarify the question by stating which libraries you are considering, and stating what terms like "open the edit in a new tab" mean. If "new tab"means from a web browser and not from a Python program, you may want to take a look at BeautifulSoup or Mechanize.

woooee 814 Nearly a Posting Maven

Vegaseat's example from this forum

# explore the ttk.Progressbar of the Tkinter module ttk
# ttk is included with Python 3.1.1
 
import tkinter as tk
from tkinter import ttk
 
def click(event):
    # can be a float
    increment = 4
    pbar.step(increment)
 
 
root = tk.Tk()
root.title('ttk.Progressbar')
 
pbar = ttk.Progressbar(root, length=300)
pbar.pack(padx=5, pady=5)
 
btn = tk.Button(root, text="Click to advance progress bar")
# bind to left mouse button click
btn.bind("<Button-1>", click)
btn.pack(pady=10)
 
root.mainloop()
woooee 814 Nearly a Posting Maven

Your link gives a 404 error

Well, Im sorry you had to see this...
...but this page doest exist. Does that even make SENSE? Try it again. If that doest work, falcon punch your computer - especially if its a Macboo--*shot*.

woooee 814 Nearly a Posting Maven

#now retrieve next item in list without looping again
#something like record.next()

Use readlines, which reads the file into a list.

f_data = open('file.txt').readlines()
while ctr in range(5):     ## first 5 only
    print "this_rec", f_data[ctr]
    if ctr > 0:
        print "previous_rec",  f_data[ctr-1]
    print "next_rec", f_data[ctr+1]
    print "-"*50

There are many examples of readlines() use on the web so anything further is not necessary here.

woooee 814 Nearly a Posting Maven

"board" is global and a list, which is why you can pass it to a function but not catch the return and still have an updated board. Either pass and return the variable (the accepted method) or delete the variable in the function definition. This code can possibly reach a recursion limit.

if board[int(move)-1] == "X" or board[int(move)-1] == "O":
            print("That space has already been taken.")
            player_move(board)
        board[int(move)-1] = "X"
#
# a better way
def player_move(board):
    try:
        move = input("Enter an empty space's number ")
        ## will also loop if letters are input
        while move < "0" or move > "8" or board[int(move)-1] not in ["X", "O"]:
 
            print("That space has already been taken.")
            move = input("Enter an empty space's number ")
        board[int(move)-1] = "X"

The "tie" code is in the winner function.

## although the squares are numbers not "" but it is the same principle
    if "" not in board:
        return "game is a tie"

Testing for a win without letting another move be made first, and printing if it is a tie.

def main():
    make_board()
    display_board(board)
    the_winner = winner(board)
    while not the_winner:
        for next_turn in [player_move(board), computer_move(board)]:
            if not the_winner:     ## don't execute if previous move's result was a winner
                next_turn
                the_winner=winner(board)
                display_board(board)
    if the_winner not in ["X", "O"]:
        print "The game is a tie"  ## or congrat_winner("")
    else:
        congrat_winner(the_winner)
    input("Press enter to exit: ")

Also, player_move() and computer_move() should be one function which you pass either "X" or "O" to indicate who's moving.

woooee 814 Nearly a Posting Maven

Too late to change it now. I have no problems with the OP doing a little debugging anyway, and since this post was in many forums, probably someone else has already provided enough to answer the OP's question.

woooee 814 Nearly a Posting Maven

The code the OP posted creates lists

energy_in=energy_file_in.readlines()
slab_in=slab_file_in.readlines()

woooee 814 Nearly a Posting Maven

Assuming both files are the same length (if they are not you will have to account for that), use the same offset for each list, i.e. record 1 from file a-->record 1 from file b

for ctr in len(energy_in):
    ## print them for testing
    print energy_in[ctr], slab_in[ctr]
    energy=energy_in[ctr].split()
    ##for j in slab_in:
    slab=slab_in[ctr].split()

    if energy[0] == slab[0]:
        x = "%0.7f" % (float(energy[1])+float(slab[1]))
    else:
        print "Recs not equal", energy, slab

If you want to find all "A"s and add them together, and the files do not correspond, then you should use a dictionary.

Pls can someone

Please don't turn this forum into a high school.

woooee 814 Nearly a Posting Maven

You have to iterate over the list.

data_list=[('Geo','Elephant',['hay','peanuts']),
      ('Gerald','Gnu',['leaves','shoots']),
      ('Leo','Leopard',['meat'])]
 

for name,familie,feed in data_list:
    print name, familie
    for each_item in feed:
        print "     ", each_item
woooee 814 Nearly a Posting Maven
woooee 814 Nearly a Posting Maven

That is correct, you are comparing for highest price.

## copied with code tags for other readers
num=0
price=0
lowest=0
HST=0.13
items=0

print "Enter 0 to print receipt.\n-----------------------"

while price>0:

    price=raw_input("Enter your price here: $")
    price=float(price)
    num=num+price#num is the subtotal
    print "tag2"

    while price<0:
        print "Invalid number"
        price=raw_input("Enter your price here $")
        price=float(price)
        num=price+num
        print "tag 3"
        
    ##if (price>0):
    ## if (price>0) is redundant as you check for greater than zero with the while()
    ## while price<0:     should be <= 0
    ##     print "Invalid number"
    if (lowest < price): 
            print "new lowest-->from", lowest, "to", price
            lowest=price

    items=items+1 #total amount of items




print "Subtotal: " ,num
print "Discount: " ,lowest
print "After discount: " ,num-lowest
print "HST: " ,(num-lowest)*HST
print "Total: " ,(num-lowest)+((num-lowest)*HST)
print "-----------------------"
print "tag4"
woooee 814 Nearly a Posting Maven

Yes it is. Do you get the error on the next line in the program? We don't know since you didn't include the entire error message, but it appears that the compiler has gone to the next line looking for the missing apostrophe.

## This works without any errors
data=[('Geo','Elephant',['hay','peanuts']),
      ('Gerald','Gnu',['leaves','shoots']),
      ('Leo','Leopard',['meat'])]

for name,familie,feed in data:
    print name, familie, feed

Also, the following line does nothing that I can see, and you only use commit() to commit any changes to the database, not after a query.

cursor.execute("""SELECT name,feed FROM animal JOIN food ON animal.id=food.anid WHERE name=%s and feed=%s""",(name,feed)) 
#
# Do you want "for name,familie,feed in data:" or "for feed in data:"
for name,familie,feed in data:
    cursor.execute("""SELECT name,feed FROM animal JOIN food ON animal.id=food.anid WHERE name=%s and feed=%s""",(name,feed))
 
    for feed in data:

P.S. For future reference, if you want some one to assist you with your code, at least try the suggestions before you say that that isn't it, and explain what happens after the change/correction. We will try them, so we know if they are correct or not.

woooee 814 Nearly a Posting Maven

Sorry, Tony already answered. The indent is probably incorrect.

woooee 814 Nearly a Posting Maven

I need to have it so that it knows when a note button is clicked

The standard way is to set some variable. In Tony's code, a button click calls play_note() and sends it the note and key. You could use the key to tell which button is clicked and possibly link it to a dictionary that contains the function you want to execute.

woooee 814 Nearly a Posting Maven

You can use lists also to clean up the code

if (size == 1):
        ## if (style == 1):
            price_list = [0, 5.95, 7.00, 6.50, 9.00, 11.00]
            price = price_list[style]

    """     Replaces
    if (size == 1):
        if (style == 1:
            price = 5.95
        elif(style == 2):
            price = 7.00
        elif(style == 3):
            price = 6.50
        elif(style == 4):
            price = 9.00
        elif(style == 5):
            price = 11.00
    """

    ## or even 
    ## a list of lists
    ## the outer list=the size
    ## the inner list=the price
    ## for the first two sizes only
    size_price = [[],
                  [0, 5.95, 7.00, 6.50, 9.00, 11.00],
                  [0, 7.83, 9.00, 8.50, 11.00, 13.45]]

    for size in [1, 2]:
        this_list=size_price[size]
        for style in [2, 3, 5]:
            print "The price is %5.2f for size=%d, and style=%d" % \
                  (this_list[style], size, style) 

        #----------------------------------------------------------------
        # and similarly
        ## sub-list = quantity, sales price totals
        pizza_sales = [ [0, 0], [0, 0], [0, 0], [0, 0], [0, 0] ]
        pizza_sales[location][0] += quantity
        pizza_sales[location][1] += saleprice
        
        """  Replaces all of these type of statements
        if location == 1:
                    Loc1Pizzas += quantity
                    Loc1Sales += saleprice
        """
woooee 814 Nearly a Posting Maven

You should also incrementally test your code and not just post a load of crap and demand that we fix it for you, or otherwise we are jerks. I get that your web page is zipped in some odd form. Note that urlopen().read() returns a string or bytes, not a file object so you would use zlib to decompress it. The only way I was able to do this was to save the zipped string and use gzip with the force option to upzip it. Gzip is standard on all Linux and Mac systems, but if you are using MS Windows, you will have to experiment with what is available.

import zlib
import urllib2
import subprocess
 
def download(url):
    response=urllib2.urlopen(url)
    print 'RESPONSE:', response
    print 'URL     :', response.geturl()

    headers = response.info()
    print 'DATE    :', headers['date']
    print 'HEADERS :'
    print '---------'
    print headers

    data = response.read()
    print 'LENGTH  :', len(data)
    print 'DATA    :'
    print '---------'
    print type(data)

    name_write="./test_1.gz"
    fp=open(name_write, "wb")
    fp.write(data)
    fp.close()

    subprocess.call("gzip -df %s" % (name_write), shell=True)

download('http://www.locationary.com/place/en/US/Virginia/Richmond-page20/?ACTION_TOKEN=NumericAction')

"""----------  The first few lines of what I got  ----------
		<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
		

<html>
			<head>	  				
				<meta http-equiv="content-type" content="text/html; charset=UTF-8">
				
				
				<title>Richmond (Virginia, United States)</title>	
				<link href='http://www.locationary.com/css/style.css' rel="stylesheet" type="text/css"> 
"""

@ Tony
Is it me or is this year's group of questioners worse than in year's past. Two incidents in one day where someone who only takes and does not contribute demands that we solve their problem for them. Both of them are now on my …

woooee 814 Nearly a Posting Maven

You can code your own check using Python's isdigit() function, but as we have no way of knowing what you have studied in class, you will probably just come back and say that you haven't used it in class, so it would be a further waste of time.

def int_check(str_in):
    for ch in str_in:
        if ch < "0" or ch > "9":
            return False, str_in
    return True, int(str_in)

for test_input in ["123", "AString", "123.45"]:
    ret, num = int_check(test_input)
    if ret:
        print num, "IS an integer"
    else:
        print num, "is NOT an integer"

Note that this is the only code that I will post. If you come back and say "I don't like that" then I will say that you are on your own and will have to provide some code/effort yourself as your original question did not state any limitations, so don't expect us to keep coming back with option after option like a performing seal until you find one that you like,

woooee 814 Nearly a Posting Maven

Use subprocess not execfile

#!/usr/bin/python
#-*- coding:Utf-8-*-
# -*- coding: cp1252 -*-
 
import os
import subprocess
 
print 'hello'
#os.system("sudo chmod 777 /home/ismail/Bureau/Test/20111214") 
subprocess.call("/path/to/program/Backup1.py", shell=True)

There are many, many docs on the web about subprocess if you want to know more, as it is used in many different ways.

woooee 814 Nearly a Posting Maven

All of the else: pass statements do nothing and can be eliminated

if len(m)>1:
    Properties['Proper divisors']= str(m)
else:                 ## does nothing
    pass
#
#
while n>0:             ## you don't change "n" so this is an infinite loop
    UI=str(raw_input('What are you looking for?'))
    if UI=='Everything' or UI=='All':
        print Properties
    elif UI=='Properties' or UI=='List':
        print Properties.keys()
    elif UI in Properties:     ## print all other properties for UI
#    elif UI not in Properties:
#        pass
#    else:
        print Properties[UI]
woooee 814 Nearly a Posting Maven

Just test for it and eliminate the trailing period

test_text="prob=0.345."
test_text = test_text.strip()
if test_text.endswith("."):
    print test_text[:-1]
    print test_text[:-1].split("=")
woooee 814 Nearly a Posting Maven

You can use a function instead of two separate blocks of code, maybe, but that is possibly because I don't understand how you separate receiving ".-"; is it "et" or "a", and if there is a space between, i.e. ". -" vs ".-" then you have to split the input first.

import string

def to_from(text, dict_in):
    for char in text:
        if char.lower() in dict_in:
            print "%6s" % (dict_in[char]),
        else:
            print char, "not in dictionary"
    print

tomorse ={'a': '.-',
          'b': '-...',
          'c': '-.-.',
          'd': '-..',
          'e': '.',
          'f': '..-.',
          'g': '--.',
          'h': '....',
          'i': '..',
          'j': '.---',
          'k': '-.-',
          'l': '.-..',
          'm': '--',
          'n': '-.',
          'o': '---',
          'p': '.--.',
          'q': '--.-',
          'r': '.-.',
          's': '...',
          't': '-',
          'u': '..-',
          'v': '...-',
          'w': '.--',
          'x': '-..-',
          'y': '-.--',
          'z': '--..',
        '0': '-----',           ',': '--..--',
        '1': '.----',           '.': '.-.-.-',
        '2': '..---',           '?': '..--..',
        '3': '...--',           ';': '-.-.-.',
        '4': '....-',           ':': '---...',
        '5': '.....',           "'": '.----.',
        '6': '-....',           '-': '-....-',
        '7': '--...',           '/': '-..-.',
        '8': '---..',           '(': '-.--.-',
        '9': '----.',           ')': '-.--.-',
        ' ': ' ',               '_': '..--.-'
}
frommorse = dict((b,a) for a,b in tomorse.items())

text = raw_input('What is the translation you need?\n')
text=text.strip()
 
if text[0] in string.letters:
    to_from(text, tomorse)
else:
    to_from(text, frommorse)
woooee 814 Nearly a Posting Maven

I get these errors and have not tested further

Traceback (most recent call last):
File "./test_1.py", line 96, in <module>
value = tomorse[char]
NameError: name 'char' is not defined

Traceback (most recent call last):
File "./test_1.py", line 98, in <module>
if (char.lower() == key):
NameError: name 'char' is not defined

woooee 814 Nearly a Posting Maven

The OP has it correct

I need to print data using if-elif statement
elif row=='muta55':

.

woooee 814 Nearly a Posting Maven

if text == char: should yield an error since "char" has not been declared. If you want to test for letters it is easier to test for dot or dash as the if and use letters in the else (asuming there are no periods or dashes when letters are input).

## frommorse first
if "." in text or "-" in text:
# or
# if text[0] in frommorse:     ## assumes text does not start with dot or dash
    morse_list = list()
    for char in text:
        ## replace the following two statements with
        if char in frommorse:
        ##for key in frommorse:
                ##if (char.lower() == key):
                        value = frommorse[char]
                        morse_list.append(value)
        ## allow for errors in entry or in the dictionary (like no lower case "z")
        else:
            print char, "not in dictionary"

else:
    ## tomorse code

You can use
if char in string.letters:
as a test for letters vs. dots and dashes.

Print the dictionary, frommorse, somewhere in the code. A dictionary can not have multiple keys that are the same, so it does not contain what you think it does.

woooee 814 Nearly a Posting Maven

You have to test for more than a period unless you know the sentences won't contain abbreviations. Take a look at this variation:

import re

def sentCapitalizer():
    s = 'the money is in the bag Mr. Jones. however you dont want it.'

    rtn = re.split('([.!?] *)', s)
    print('')
    print(''.join([each.capitalize() for each in rtn]))

sentCapitalizer()
woooee 814 Nearly a Posting Maven

We don't have the Button class so can't test your code. Also, if the Button class does not provide a callback (way to call a function when clicked) you will have to write your own. So far you have done very little, even the easy things like randomly choose one door, get the player's selection, etc. so there probably won't be many replies.

woooee 814 Nearly a Posting Maven

Christmas marks the birth of Christ, and it is celebrated by Christians around the world. But this holiday has close ties to an older festival known as the "Unconquered Sun." The impact this Pagan tradition had on how Christmas was celebrated is one of the ways in which The Christian tradition changed as it developed through the ages.

December 25th was the date of the winter solstice in the calendar Julius Caesar devised for Rome in 46 BC. Today the winter solstice usually occurs on December 21st. Although Caesar used a 365 1/4 day year, a year is actually a little shorter, and this made the solstice occur a little earlier over the years. There was a discrepancy of 1 day in 128 years.

There is nothing in the Christian Bible to specify the day of Christmas. Prior to the fourth century, Christ’s birth had been associated with Three King’s Day on January 6. But the pagans and the newly converted were being a major problem to the church because they were still celebrating the Unconquered Sun. Nothing the church did or said made a difference; the winter solstice was just too important a festival.

What the Christians did in this dilemma, was execute a move seen over and over in history. If you can’t defeat them, and refuse to join them, at least make it appear that you defeated them. Sometime between AD 354 and 360 a few decades after Emperor Constantine’s conversion to Christianity, the …

woooee 814 Nearly a Posting Maven

This post is the same as http://www.daniweb.com/software-development/python/threads/398951 Take a look at it first, and then post any further questions.

woooee 814 Nearly a Posting Maven

You don't need the separate funcion "displayEnglishDigits(List)"; just put the lookup and print in "englishDigits(Number)". Although "englishDigits" will probably receive a list, not a number, since it has to delete the number printed, and send the remaining digits on through the recursive calls.

def recursive_print(list_in):
    """ this is not a solution to your homework but an example of using a
        print statement within a recursive function
    """
    if len(list_in):
        print list_in[0]          ## print before the function calls itself
        recursive_print(list_in[1:])
        print ".....", list_in[0] ## print after the function calls itself

    ## no items in list so just return without any more calls
    ## this is not required as the function would return without this but
    ## it makes the code more readable IMHO
    else:
        return

test_list = range(7)
print test_list, "\n"
recursive_print(test_list)

Also, you can use a list (which I hope you understand) instead of a dictionary, as the first item of a list is at zero offset-->"zero", the second item's offset is 1-->"one" (or you jump over this many items).

num_lit = ["zero", "one", "two"]    ## etc
num = 0
print num, num_lit[num]
num=2
print num, num_lit[num]
woooee 814 Nearly a Posting Maven

You don't need functions for something this simple:

num_english = {0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four",
                  5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine"}

for num in [0, 5]:
   print num, num_english[num]

So now, all you have to do it iterate over the numbers. You should not use code (like dictionaries) without understanding it first.

woooee 814 Nearly a Posting Maven

You open the file every pass through the loop, and only read one record. Read the file once before the loop and store it (like the list of lists below), then access the stored values.

file_object = open('herp.txt', 'r')
data_as_list = file_object.readlines()
file_object.close()

product_list_of_lists = []
##  process 2 records at a time
for ctr in range(0, len(data_as_list), 2):
    product = data_as_list[ctr].strip()
    price = data_as_list[ctr+1].strip()
    product_list_of_lists.append([product, price])
for product, price in product_list_of_lists:
    print product, price
woooee 814 Nearly a Posting Maven

The following works for me. Check the rest of your code that is not posted for differences.

from Tkinter import *
class MyDialog:
 
    def __init__(self,parent):
        self.Frame1= Frame(parent)
        self.Frame1.pack()
 
        self.enabled = IntVar()
 
        self.checkbutton = Checkbutton(self.Frame1,text = "Enable Email Option", variable=self.enabled,command=self.OnCheckBoxClick)
        self.checkbutton.pack()
 
 
    def OnCheckBoxClick(self):
        iTemp = self.enabled.get()
        print "iTemp %s"%iTemp

root=Tk()
M=MyDialog(root)
root.mainloop()
woooee 814 Nearly a Posting Maven

I am trying to read a text file into a 2D list.

Assuming you want each record to be one row of the 2D list, you are making your code too complicated.

infile = open(infile,"r")
 
    old_2D =[]
    for line in infile:
        line = line.strip()
        new_row = []          ## start with an empty list for each record

        ## you can also use
        ## for num in line:
        ##     new_row.append(num)
        ## or new_row = list(line)
        for ctr in range(len(line)):
              new_row.append(line[ctr])

        ## this row is finished so append it to old_2D
        old_2D.append(new_row)

    print old_2D

You should read the Python style guide as it makes everyone's code easier to read (i.e. variable names are lower case, and don't use "i', "l", or "o" as variable names as they can look like number or other letters especially at first glance "i"-->"l"-->"1").

woooee 814 Nearly a Posting Maven

You can use sets for this

and colour.split() in colourslst:

colours_set = set(colourslst)
input_set = set(colour.split())
if input_set.issubset(colours_set):

The result should be repetitive body's if input is invalid

Use something like this which will repeat if any of the conditions are false, but I think you want to repeat each input item individually until it is correct and then go on to the next input. The way you are doing it, if one input item is incorrect you have to re-enter all items.

valid = False
while not valid:
    ## enter input here
    if len(colours.split()) == 4:
        if input_set.issubset(colours_set):
            if 2 < width < 8 and 2 < height < 8:
                valid = True
woooee 814 Nearly a Posting Maven

Note the split on "DATE:" that I added to the above post, which may work better.

And Hex 7f = decimal 127 so you should be able to replace it.

woooee 814 Nearly a Posting Maven

To append the two recs together, you want to say something like,

data=open(fname, "r").readlines()
for ctr in len(data):
    if data[ctr].strip().startswith("DATE:"):
        print data[ctr].strip(), data[ctr+1].strip()

EOL though is actually decimal 10 or 13 or a combination of the two. Decimal 127 is Delete. To eliminate it, try something like this:

eliminate=chr(127)
rec=rec.replace(eliminate, " ")

If this does not work, iterate one of the lines character by character and print the character and ord(character), one per line, and substitute the offending character's ord for decimal 127 in the above code.

You can also use:

data=open(fname, "r").read()    ## read a one long string
## "DATE" will no longer appear but you know that each individual rec started with it
data_split = data.split("DATE:")
for rec in data_split:
    print rec
woooee 814 Nearly a Posting Maven

You don't ever exit the "while True" loop.

and colour.split() != colourslst:
This will never be true because one has four colors and one has 5 colors (excuse me, 'colours'). You definitely want to add some print statements to see what is happening in the program.

woooee 814 Nearly a Posting Maven

An example of a partial Tkinter interface. You can decide if you want to implement more.

try:
    import Tkinter as tk     ## Python 2.x
except ImportError:
    import tkinter as tk     ## Python 3.x

class VendingMachine(object):
    def __init__(self):
        self.item_dict = {}

        self.root = tk.Tk()
        self.root.geometry("100x50+50+200")

        self.create_menu()
        b = tk.Button(self.root, text="Exit Program",
                      command=self.root.quit, bg='red', fg='black')
        b.grid(row=10, column=0)
        self.print_menu()
        self.root.mainloop()

    def add_new_item(self):
        """ retrieves name only as this is just an example
        """
        self.menu_frame.withdraw()   ## shut down option menu for now
        self.add_frame = tk.Toplevel(self.root)
        self.add_frame.geometry("200x150+50+10")

        name_label = tk.Label(self.add_frame, text="Name")
        name_label.grid(row=0, column=0)

        self.entry_1 = tk.StringVar()
        name = tk.Entry(self.add_frame, textvariable=self.entry_1)
        name.grid(row=0, column=1)

        b = tk.Button(self.add_frame, text="Add this", command=self.get_values)
        b.grid(row=1, column=0)
        b = tk.Button(self.add_frame, text="No Add Exit", command=self.exit_item_menu)
        b.grid(row=1, column=1)

        name.focus_set()

    def buy_item(self):
        """ not implemented
        """
        print "buy_item called"

    def create_menu(self):
        """ create the menu in it's own frame, once only.  It can be withdrawn and
            re-displayed
        """
        self.menu_frame = tk.Toplevel(self.root)
        self.menu_frame.geometry("200x100+10+10")

        ## we don't use "b" so all buttons can use "b" to catch the return value
        b = tk.Button(self.menu_frame, text="Add new item",
                      command=self.add_new_item, bg='lightblue', fg='white')
        b.grid(row=0, column=0)
        b = tk.Button(self.menu_frame, text="Buy an item",
                      command=self.buy_item, bg='lightblue', fg='white')
        b.grid(row=1, column=0)
        b = tk.Button(self.menu_frame, text="Update item's quantity",
                      command=self.update_item_quantity, bg='lightblue', fg='white')
        b.grid(row=2, column=0)
        self.menu_frame.grid()
        self.menu_frame.withdraw()  ## withdraw the frame so print_menu can deiconify

    def exit_item_menu(self):
        """ destroy the 'enter new item' frame and display the menu
        """
        self.add_frame.destroy()
        self.print_menu()

    def get_values(self):
        name=self.entry_1.get()
        if name not in self.item_dict:
            ## fill with generic values since we haven't implemented getting values
            self.item_dict[name] = ['code', 'amount', 'quantity']
            print self.item_dict
        else: …
woooee 814 Nearly a Posting Maven

What do you want to do in Tkinter other than the menu, and what do you want the entire program to do? A couple of comments:

def __init__(self,denom,value):
        self.Denomination = "CENTS"
        self.Value = 0

        ## if the value is not 25 or 50 then self.Value remains at zero
        ## what if someone uses 2 dimes and a nickel?
        ## How can the value be anything other than 25 or 50, since that is all
        ## that your functions will allow which means you don't have to test it.
        if value == 25 or value == 50:
            self.Value = value

    def setValue(self,v): 
        self.Value = 0

        ## you should be getting an error message as "value" has not 
        ## been declared in this function
        if value == 25 or value == 50:
            ## and shouldn't it be "self.Value += coin" to allow for multiple coins
            self.Value = value

Does this code run as is, or do you want to also debug it?

Instead of a class for each item in the vending machine, with a bunch of functions that do nothing other than return the value of the variable, how about using a dictionary instead, in the VendingMachine class. self.item_dict[name] = [code, price, quantity]. Also, I would put Insert25Cents and Insert50Cents under the BuyItem function since you don't know what some one should insert until they decide to buy and item. Your code is unnecessarily complex, even as practice for using classes. A class is supposed to be self-contained, i.e. …

woooee 814 Nearly a Posting Maven

And what happens when they guess "books" and it is "bones". You have to eliminate a letter that is found or it will "find" two o's when there is only one. Since we don't know what kind of containers realWord and guess are, I am using a list since they are easier to work with.

real_word = "books"

for guess in ["bones", "good", "bookkeeper"]:
    print "\n  testing", guess
    if guess != real_word:
        ## list of "_" to be updated with letters found in both words
        guess_list = ["_" for x in range(len(real_word))]
        real_list = list(real_word.lower())
        for char in guess:
            if char in real_list:
               offset = real_list.index(char) ## offset position of the found letter
               guess_list[offset] = char      ## update with correct letters
               real_list[offset] = "*"        ## letter found so don't test it again
            else:
                print(char)# If not in word print letter alone

    print guess_list
    print real_list, "= real_list"  ## for testing
woooee 814 Nearly a Posting Maven

It should be

if b in line:
                          print line.find(b)

as the two statements are related.

woooee 814 Nearly a Posting Maven

You read the file into a list but write the file as one string. Instead write one tuple per record. And delete loadTextString() as that is just confusing things.

save_text(listOfOldScores, "high scores.txt")
#
def save_text(scores_list, file_name):
    file_handler = open(file_name, "w")
    for tup in scores_list:
        file_handler.write("%s, %d\n" % (tup[0], tup[1]))  ## name and score
    file_handler.close()
woooee 814 Nearly a Posting Maven

You should not use "i", "l", or "O" for variable names as they can look like digits as well as other letters. This code is a good example of why. You will have to discover the problem yourself (the problem may be caused by being too lazy to key in the extra letters), but the following code works for some reason whereas yours does not.

list_in = range(1, 10)
total=0
ctr=0
while (ctr < len(list_in)):
    total += list_in[ctr]
    ctr += 1
print total
woooee 814 Nearly a Posting Maven

if door == 1 and b1.clicked(pt):
AttributeError: 'NoneType' object has no attribute 'clicked'

I am not that familiar with the GUI named "graphics", but obviously b1==None which means it has no method clicked, or any other method. Examples of creating buttons exist here on Daniweb as well as on the web. Compare what the example is doing to what you have.

woooee 814 Nearly a Posting Maven

but when the chunk is inserted, each item gets a "\n"

Python does not write a "\n" to a file as it does with a print statement. If there is a "\n" it must be in the string, so print the string so you know what is being added. Also, ImageMagick will append two PNG files so use it if you can as it is tested.

woooee 814 Nearly a Posting Maven

That is not list append, but a list insert. Another way to do it to create a new, third list by appending list 1 until "+++++++" is found, then append list 2, then append the rest of list 1.