Hi,
I am trying to make my "Save All" button to save whatever is selected from the option menu or dropdown to that particular file.
So if I have "animation" selected from the option menu it saves to the animation file 'ji.txt','r+'.
Or if I have "compositing" selected from the option menu it saves to the animation file 'journalinput.txt', 'r+'.
I am also planing to add more to the option menu.

I think I have gotten really close but need just a little help.I done this in python v.3.4.1
Thanks

Here's my code

from tkinter import *


app = Tk()
app.title("GUI Example")
app.geometry('460x460+200+200')

def main():
pass

def animation():
f = open('ji.txt','r+')
journText.delete(1.0, END)

emptyCompString  =""
for i in f:
emptyCompString += i

journText.insert(END, emptyCompString )
f.close()
return

def compositing():
f = open('journalinput.txt','r+')
journText.delete(1.0, END)

emptyCompString =""
for i in f:
emptyCompString += i

journText.insert(END, emptyCompString)
f.close()
return

def openFiles(selection):
if selection == "animation":
saveAnim(), animation()
if selection == "compositing":
saveComp(), compositing()
return

def saveAll():
if selectJourn=='animation':
saveAnim()
if selectJourn=='compositing':
saveComp()
return

def saveAnim():
anim = journText.get(1.0, END)  
outToFile = open('ji.txt', 'r+')
outToFile.write('\n'+anim)
outToFile.close()
return

def saveComp():
comp = journText.get(1.0, END)
outToFile = open('journalinput.txt', 'r+')
outToFile.write('Sub-Subsject:\n' + comp)
outToFile.close()
return

selectJourn = StringVar()
selectJourn.set('subject')
files = ["animation","compositing"]
selectDropDown = OptionMenu(app, selectJourn, *files, command=openFiles)
selectDropDown.place(x=0, y=1)

button1 = Button(app, text = " Save  All ", width = 10, command = saveAll)
button1.place(x=200, y=5, width= 105)

journText = Text(app, height = 5, width = 63)
journText .insert(END,'')
journText .place(x= 7, y = 40)



if __name__=='__main__':main()
app.mainloop()
commented: one does not simply post a python code without indents! +0

Re upload your code with working indentation.

commented: good call. esp since it's python! +0

ok, thanks

from tkinter import *


app = Tk()
app.title("GUI Example")
app.geometry('460x460+200+200')

def main():
   pass

def animation():
   f = open('ji.txt','r+')
   journText.delete(1.0, END)

   emptyCompString  =""
   for i in f:
         emptyCompString += i

   journText.insert(END, emptyCompString )
   f.close()
   return

def compositing():
   f = open('journalinput.txt','r+')
   journText.delete(1.0, END)

   emptyCompString =""
   for i in f:
       emptyCompString += i

   journText.insert(END, emptyCompString)
   f.close()
   return

def openFiles(selection):
    if selection == "animation":
          saveAnim(), animation()
    if selection == "compositing":
          saveComp(), compositing()
    return

def saveAll():
   if selectJourn=='animation':
      saveAnim()
   if selectJourn=='compositing':
      saveComp()
   return

def saveAnim():
    anim = journText.get(1.0, END)  
    outToFile = open('ji.txt', 'r+')
    outToFile.write('\n'+anim)
    outToFile.close()
    return

def saveComp():
    comp = journText.get(1.0, END)
    outToFile = open('journalinput.txt', 'r+')
    outToFile.write('Sub-Subsject:\n' + comp)
    outToFile.close()
    return

selectJourn = StringVar()
selectJourn.set('subject')
files = ["animation","compositing"]
selectDropDown = OptionMenu(app, selectJourn, *files, command=openFiles)
selectDropDown.place(x=0, y=1)

button1 = Button(app, text = " Save  All ", width = 10, command = saveAll)
button1.place(x=200, y=5, width= 105)

journText = Text(app, height = 5, width = 63)
journText .insert(END,'')
journText .place(x= 7, y = 40)



if __name__=='__main__':main()
app.mainloop()

tuples of function calls without using their return values here are very strange for me

    def openFiles(selection):
        if selection == "animation":
              saveAnim(), animation()
        if selection == "compositing":
              saveComp(), compositing()
        return

Thanks. I just started learning python 2 week ago, so there is definetly stuff wrong. I put the return's in the right place but that didn't change anything. I have tried lots of ways it should work but none do.
I just need my save all button to know what is selected in the option menu and save to that selected file.
Anymore help would be much appreciated.
Thanks.

You have to use the get() method of the StringVar. See the second, or get() example at Click Here i.e convert from a Tkinter variable to a Python variable

Thanks alot.That's what I needed and the link is extremely helpfull too.
Much appreciated.