views:

34

answers:

1

hello there i am making a text editor in Tkinter (python) and so i made a menu and wanted to know how i can call a function that will display the windows Save-as or open boxes that every program uses. For example in notepad you can click file-save and then it opens the windows save box. I already have the menu but how can i open the save box. Thanks a lot.

A: 

Here is an example from http://www.daniweb.com/forums/thread39327.html:


import tkFileDialog

def open_it():
    filename = tkFileDialog.askopenfilename()
    print filename  # test

def save_it():
    filename = tkFileDialog.askopenfilename()
    print filename  # test

def save_as():
    filename = tkFileDialog.asksaveasfilename()
    print filename  # test

Justin Ethier
Thank You So Much
Matthew Carter