Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ok I've figured it out as well as fixed the bug that plagued my earlier idea.

import Tkinter, tkFileDialog, ntpath root = Tkinter.Tk()
root.withdraw() filetypes = [('Excel Workbook', '.xlsx'),('All Files','.*')] filenamesaveas = tkFileDialog.asksaveasfilename(filetypes=filetypes, title='Results Workbook Name')

xlsfilename = ntpath.basename(filenamesaveas)

The 'root = Tkinter.Tk()' etc is to stop a dummy Tkinter window coming up that crashes PSS/E if it's closed.

Ok I've figured it out as well as fixed the bug that plagued my earlier idea. idea (sorry this posted code still doesn't look that good).

import Tkinter, tkFileDialog, ntpath ntpath

root = Tkinter.Tk()
root.withdraw() root.withdraw()

filetypes = [('Excel Workbook', '.xlsx'),('All Files','.*')] filenamesaveas = tkFileDialog.asksaveasfilename(filetypes=filetypes, title='Results Workbook Name')

xlsfilename = ntpath.basename(filenamesaveas)

The 'root = Tkinter.Tk()' etc is to stop a dummy Tkinter window coming up that crashes PSS/E if it's closed.

Ok I've figured it out as well as fixed the bug that plagued my earlier idea (sorry this posted code still doesn't look that good).

import Tkinter, tkFileDialog, ntpath

root = Tkinter.Tk()
root.withdraw()

filetypes = [('Excel Workbook', '.xlsx'),('All Files','.*')] .*')]

filenamesaveas = tkFileDialog.asksaveasfilename(filetypes=filetypes, title='Results Workbook Name')

xlsfilename = ntpath.basename(filenamesaveas)

The 'root = Tkinter.Tk()' etc is to stop a dummy Tkinter window coming up that crashes PSS/E if it's closed.

click to hide/show revision 4
highlighted code

Ok I've figured it out as well as fixed the bug that plagued my earlier idea (sorry this posted code still doesn't look that good).

import Tkinter, tkFileDialog, ntpath

ntpath

root = Tkinter.Tk()
root.withdraw()

root.withdraw()

filetypes = [('Excel Workbook', '.xlsx'),('All Files','.*')]

'*.xlsx'),('All Files','*.*')]

filenamesaveas = tkFileDialog.asksaveasfilename(filetypes=filetypes, title='Results Workbook Name')

Name')

xlsfilename = ntpath.basename(filenamesaveas)

ntpath.basename(filenamesaveas)

The 'root = Tkinter.Tk()' etc is to stop a dummy Tkinter window coming up that crashes PSS/E if it's closed.

click to hide/show revision 5
No.5 Revision

Ok I've figured it out as well as fixed the bug that plagued my earlier idea (sorry this posted code still doesn't look that good).

import Tkinter, tkFileDialog, ntpath

root = Tkinter.Tk()                               
root.withdraw()

filetypes = [('Excel Workbook', '*.xlsx'),('All Files','*.*')]

filenamesaveas = tkFileDialog.asksaveasfilename(filetypes=filetypes, tkFileDialog.asksaveasfilename(
                              filetypes=filetypes, 
                              title='Results Workbook Name')

xlsfilename =  ntpath.basename(filenamesaveas)

The 'root = Tkinter.Tk()' etc is to stop a dummy Tkinter window coming up that crashes PSS/E if it's closed.