I have a text editor made with Python and tkinter.
This is my \'open file\' method:
def onOpen(self): file = askopenfile(filetypes=[(\"Text files
You are passing the file object so you see the reference to the file object as the title, you can get the name from the file object with name = root.title(file.name).
name = root.title(file.name)
If you want just the base name use os.path.basename:
import os name = os.path.basename(file.name)