本文整理汇总了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()