Python tkFileDialog.asksaveasfile() Examples

The following are 6 code examples of tkFileDialog.asksaveasfile(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkFileDialog , or try the search function .
Example #1
Source File: simple_beam_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def save_inputs(self, *args):

        out_file = tkFileDialog.asksaveasfile(mode='w', defaultextension=".simpbm")

        if out_file is None:
            return

        for data in self.inputs:
            text = '{0}\n'.format(data.get())
            out_file.write(text)

        out_file.write('*Loads*\n')
        for load in self.loads_gui_select_var:
            text = '{0},{1},{2},{3},{4},{5},{6}\n'.format(load[0].get(),load[1].get(),load[2].get(),load[3].get(),load[4].get(),load[5].get(),load[6].get())
            out_file.write(text)
        out_file.close() 
Example #2
Source File: simple_beam.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def save_inputs(self, *args):

        out_file = tkFileDialog.asksaveasfile(mode='w', defaultextension=".simpbm")

        if out_file is None:
            return

        for data in self.inputs:
            text = '{0}\n'.format(data.get())
            out_file.write(text)

        out_file.write('*Loads*\n')
        for load in self.loads_gui_select_var:
            text = '{0},{1},{2},{3},{4},{5},{6}\n'.format(load[0].get(),load[1].get(),load[2].get(),load[3].get(),load[4].get(),load[5].get(),load[6].get())
            out_file.write(text)
        out_file.close() 
Example #3
Source File: fisheye.py    From DualFisheye with MIT License 5 votes vote down vote up
def save_config(self, filename=None):
        if filename is None:
            file_obj = tkFileDialog.asksaveasfile()
            if file_obj is None: return
        else:
            file_obj = open(filename, 'w')
        try:
            save_config(file_obj, self.lens1, self.lens2)
        except:
            tkMessageBox.showerror('Config save error', traceback.format_exc())

    # Render and save output in various modes. 
Example #4
Source File: fisheye.py    From DualFisheye with MIT License 5 votes vote down vote up
def _render_generic(self, render_type, render_size=1024):
        # Popup asks user for output file.
        file_obj = tkFileDialog.asksaveasfile(mode='wb')
        # Abort if user clicks 'cancel'.
        if file_obj is None: return
        # Proceed with rendering...
        self._set_status('Rendering image: ' + file_obj.name, 'wait')
        try:
            panorama = self._create_panorama()
            render_func = getattr(panorama, render_type)
            render_func(render_size).save(file_obj)
            self._set_status('Done!')
        except:
            tkMessageBox.showerror('Render error', traceback.format_exc())
            self._set_status('Render failed.') 
Example #5
Source File: gui_main.py    From PlotIt with MIT License 5 votes vote down vote up
def save_file():
    file=fdialog.asksaveasfile(mode="wb", title="Save Figure", defaultextension=".png", filetypes = (("png files","*.png"),("all files","*.*")))
    if file is None:
        return None
    img_to_save=open(".temp/generated_plot.png","rb").read()
    file.write(img_to_save)
    file.close() 
Example #6
Source File: strap_beam_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def save_inputs(self, *args):
        
        out_file = tkFileDialog.asksaveasfile(mode='w', defaultextension=".strapbm")
        
        if out_file is None:
            return
        
        for data in self.inputs:
            text = '{0}\n'.format(data.get())
            out_file.write(text)
        
        out_file.close()