So I have this code
class createNewFile:
def createNewFile(createFileEntry):
string = StringVar()
createFileEntry = Entry( CROW, textvariable = string)
createFileEntry.pack()
createFileEntry.focus_set()
def saveNewFile(message):
filename = createFileEntry.get()
extention = filename
target = open (extention, 'a')
message = tkMessageBox.showinfo('What happened','Recived ' +getFileEntry+' as filename')
newFileButton = createNewFile()
newFileButton.createNewFile()
newFileButton.saveNewFile
newFileIcon = PhotoImage(file='icons/newFile.png')
createFileBtn = Button(toolbar, image = newFileIcon, command = newFileButton.createNewFile,relief='solid',background='white', border=0)
createFileBtn.pack(side=LEFT, padx=0,pady=0)
saveFileIcon = PhotoImage(file='icons/saveFile.png')
saveFileEntry = Button(toolbar,image = saveFileIcon, command = newFileButton.saveNewFile,relief='solid',background='white', border=0)
saveFileEntry.pack(side=LEFT, padx=0,pady=0)
and the idea is for the new file button to create a entry space to get the name and extension of the file, and the save button to write it.
I read here in stack overflow how to set up the class for you to be able to call a variable from one function to another, but it didn't work. What am I doing wrong?