本文整理汇总了Python中tkFileDialog.asksaveasfile函数的典型用法代码示例。如果您正苦于以下问题:Python asksaveasfile函数的具体用法?Python asksaveasfile怎么用?Python asksaveasfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了asksaveasfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: file_save2
def file_save2(self):
Out=str(rospy.Time.now())+", "+str(self.x)+" "+str(self.y)+" "+str(self.z)+" "+str(self.Rz)+" "+str(self.Ry)+" "+str(self.Rx)+"\n"
f2 = tkFileDialog.asksaveasfile(mode='a', defaultextension="",initialdir="/home/philip/FastResults/Calibration/")
if f2 is None: # asksaveasfile return `None` if dialog closed with "cancel".
return
f2.write(Out)
f2.close() # `()` was missing.
示例2: save_command
def save_command():
file = tkFileDialog.asksaveasfile(mode='w')
if file != None:
# slice off the last character from get, as an extra return is added
data = txt.get('1.0', END+'-1c')
file.write(data)
file.close()
示例3: save_as
def save_as():
global saved_filename
handle = tkFileDialog.asksaveasfile(mode='w')
if handle:
saved_filename = handle.name
model.save(saved_filename)
update_ui_hints(None)
示例4: save_file
def save_file(self):
fileToSave = tkFileDialog.asksaveasfile(mode='w', defaultextension = ".txt")
text2save = []
other_acts=[]
for period in range(12):
text2save.append([])
for group in range(len(self.groups)):
if self.groups[group].get_schedule()[period] in self.activities:
text2save[period].append(self.activities.index(self.groups[group].get_schedule()[period]))
else:
o_act = self.groups[group].get_schedule()[period]
other_acts.append([o_act.get_name(), o_act.get_min_age(), o_act.get_max_age(),
o_act.get_competing_activity(), o_act.not_days, [self.activities.index(o_act.other_act[0]),
self.activities.index(o_act.other_act[1])]])
text2save[period].append(100)
activity_list = []
for act in self.activities:
if type(act.get_competing_activity()) == type(None):
activity_list.append([act.get_name(), act.get_min_age(), act.get_max_age(),
act.get_competing_activity(), act.not_days])
else:
comp_act = self.activities.index(act.get_competing_activity())
activity_list.append([act.get_name(), act.get_min_age(), act.get_max_age(),
comp_act, act.not_days])
fileToSave.write(str([text2save,activity_list, other_acts]))
fileToSave.close()
示例5: file_save
def file_save(self):
f = tkFileDialog.asksaveasfile(mode='w', defaultextension=".txt")
if f is None: # asksaveasfile return `None` if dialog closed with "cancel".
return
text2save = str(text.get(1.0, END)) # starts from `1.0`, not `0.0`
f.write(text2save)
f.close()
示例6: savemd
def savemd():
"""get a filename and save the text in the editor widget"""
# default extension is optional, here will add .txt if missing
md = tkFileDialog.asksaveasfile(mode='w', defaultextension=".md")
text2save = str(text2.get(0.0,END))
md.write(text2save)
md.close()
示例7: generateFile
def generateFile(self):
filteredString = self.parseFilterString()
if filteredString == "":
txtWindow = popupWindow(self.master, "No filter string is entered \n kindly enter a filter string")
self.master.wait_window(txtWindow.top)
print "No filter is entered"
return
file = tkFileDialog.asksaveasfile(filetypes=(("text files", "*.txt"), ("All files", "*.*")))
#TODO: here parse the string according to the filter output the file
#write data in the file
v = open(file.name,'w')
count = len(self.data)
for i in range(0, count-2):
for j in range(1, len(filteredString)):
#TODO: chcek this out!... if re.match(self.data[i].rawLineString, filteredString[j]) != None:
tempString = self.data[i].rawLineString
tempFilter = filteredString[j]
tempString = tempString.upper()
tempFilter = tempFilter.upper()
if tempString.find(tempFilter) != -1:
print "Raw Data:"+ self.data[i].rawLineString
v.writelines(self.data[i].rawLineString)
break
v.close()
示例8: _save_as
def _save_as(self):
if self.nb.tab(self.nb.select(), "text") == "control.F" :
name = tkFileDialog.asksaveasfile(mode='w',filetypes=[('control files','.F'),('all files','.*')])
text2save=str(self.txt_control.get(0.0,tk.END))
name.write(text2save)
name.close
elif self.nb.tab(self.nb.select(), "text") == "POSFF":
name = tkFileDialog.asksaveasfile(mode='w',filetypes=[('POSFF','POSFF* CONTFF*'),('all files','.*')])
text2save=str(self.txt_posff.get(0.0,tk.END))
name.write(text2save)
name.close
elif self.nb.tab(self.nb.select(), "text") == "log":
name = tkFileDialog.asksaveasfile(mode='w',filetypes=[('all files','.*')])
text2save=str(self.txt_stdout.get(0.0,tk.END))
name.write(text2save)
name.close
示例9: savetofile
def savetofile():
savefile=tkFileDialog.asksaveasfile()
stringToSave=""
for i in kids:
stringToSave=stringToSave+i+","
stringToSave=stringToSave[:-1]
savefile.write(stringToSave)
示例10: saveOutput
def saveOutput(self):
fname = tkFileDialog.asksaveasfile(mode='w', defaultextension=".bmp")
if fname:
try:
self.Img.rgb_img.save(fname)
except IOError as e:
showerror("Cannot save file", "Failed to save file\n'%s'" % fname)
示例11: exporting
def exporting(self):
"""Export the IGV plot."""
filename = tkFileDialog.asksaveasfile(mode='w', defaultextension='.png')
out_file = filename
if (out_file):
temp_image = Image.open('{}local_scripts/recent_runs/trio_igv.png'.format(self.var_gui_abs_path))
temp_image.save(filename)
示例12: save_as_command
def save_as_command():
"""get a filename and save your text to it"""
# default extension is optional, will add .txt if missing
fout = tkFileDialog.asksaveasfile(mode='w', defaultextension=".txt")
text2save = str(textbox.get(0.0, 'end'))
fout.write(text2save)
fout.close()
示例13: saveas
def saveas():
f = tkFileDialog.asksaveasfile(mode='w', defaultextension=".txt", title="Save the scan as...")
if f is None: # asksaveasfile return `None` if dialog closed with "cancel".
return
textoutput = tekst_widget.get(0.0, END)
f.write((unicode(textoutput)))
f.write("\n")
示例14: export
def export():
"""Run the real estate program"""
types = 'CSV {.csv}', 'Text {.txt}', 'All *'
filehandle = tkFileDialog.asksaveasfile(filetypes=types)
if filehandle:
realestate.realestate(command.get(), search.get(), filehandle)
filehandle.close()
示例15: variance
def variance(self, list_of_groups=None):
list_of_groups = self.group_hash.keys()
x_values = self.check_compatibility(list_of_groups)
sorted_x = sorted(list(x_values))
y_tracker = []
file_chosen = asksaveasfile(mode='wb')
#writer = csv.writer(file_chosen, delimiter = ' ')
list_of_rows = []
for x in sorted_x:
temp_list = []
num_ys = 0
for group in list_of_groups:
for spectra in self.group_hash[group].spectralList:
temp_list.append(spectra.y_to_x[x])
num_ys += 1
form = [trunc(float(x), 4), trunc(float(sum(temp_list) / num_ys), 4)]
y_tracker.append(float(sum(temp_list) / num_ys))
list_of_rows.append(form)
save_variance = saveFile(file_chosen, list_of_rows)
save_variance.save_mestrenova()
mp.plot_interp(x=sorted_x, y=y_tracker)