本文整理匯總了Python中tkFileDialog.asksaveasfile方法的典型用法代碼示例。如果您正苦於以下問題:Python tkFileDialog.asksaveasfile方法的具體用法?Python tkFileDialog.asksaveasfile怎麽用?Python tkFileDialog.asksaveasfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tkFileDialog
的用法示例。
在下文中一共展示了tkFileDialog.asksaveasfile方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: save_inputs
# 需要導入模塊: import tkFileDialog [as 別名]
# 或者: from tkFileDialog import asksaveasfile [as 別名]
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()
示例2: save_config
# 需要導入模塊: import tkFileDialog [as 別名]
# 或者: from tkFileDialog import asksaveasfile [as 別名]
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.
示例3: _render_generic
# 需要導入模塊: import tkFileDialog [as 別名]
# 或者: from tkFileDialog import asksaveasfile [as 別名]
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.')
示例4: save_file
# 需要導入模塊: import tkFileDialog [as 別名]
# 或者: from tkFileDialog import asksaveasfile [as 別名]
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()
示例5: save_inputs
# 需要導入模塊: import tkFileDialog [as 別名]
# 或者: from tkFileDialog import asksaveasfile [as 別名]
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()