Hi Everyone.
First post .. be gentle

OK, i'm quite new at this programming stuff. I've watched a few vids, grab examples, tore them apart, reconstructed them and read alot fo forums. I made my first program and in terms of the content i wanted, it is complete (and i'm quite proud to say ... unique) even got it to .exe so i'm very happy. I decided to add an extra feature so while this isn't a showstopper, i would love to sort out this issue i now have.

The idea of this section of code is to read how much free disk space i have from the current working directory and display it.

That part works, the output happens in the interpreter

Code:
def get_drivestats(drive):
    '''
    drive for instance 'C'
    returns total_space, free_space, used+space
    '''
    drive = drive.rstrip(':\\').rstrip(':/')
    sectPerCluster, bytesPerSector, freeClusters, totalClusters = \
        win32file.GetDiskFreeSpace(drive + ":\\")
    r = (
        (totalClusters*sectPerCluster*bytesPerSector/1024/1024),
        (freeClusters*sectPerCluster*bytesPerSector/1024/1024),
        ((totalClusters-freeClusters )*sectPerCluster*bytesPerSector/1024/1024)
        )
    return r

# pick a drive letter
#drive = 'C'
drive = os.path.splitdrive(os.getcwd())[0]
total_space, free_space, used_space = get_drivestats(drive)

print("""
Total = %d Mb
Free = %d Mb
Used = %d Mb""" % (total_space, free_space, used_space))
OK .. so where i'm falling over is .. i want the output in my already constructed and working output window but i keeping hitting a wall ... here's my code for it, might look a bit odd but i've tried many things and this is just the final attempt.

Code:
outputWindow.insert('1.0','Watch here for important info.\n\n')
outputWindow.insert('2.0','Size of Drive: {v} MB\n'.format(v = total_space))
My erro is the total_space isn't defined, i know this is a simple error, but blimey i can't work out why, it seems defined to me, but i'm thinking defined incorrectly for this type of output, cause if i # out the outputWindow line and run the program from my interpretor, after i quit the program, i get a free drive space results in my bottom window

I use Python 2.6
I use tkinter (i know i know ... but i needed to get my feet wet first)