本文整理汇总了Python中tkinter.filedialog.askopenfile函数的典型用法代码示例。如果您正苦于以下问题:Python askopenfile函数的具体用法?Python askopenfile怎么用?Python askopenfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了askopenfile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: start_window
def start_window():
import import_from_xlsx
if not hasattr(import_from_xlsx, 'load_state'):
setattr(import_from_xlsx, 'load_state', True)
else:
reload(import_from_xlsx)
''' tag library '''
'''
each tag library corresponds to sqlite table name
each tag corresponds to sqlite database column name
'''
''' config file '''
config = configparser.ConfigParser()
config.read(controllers + 'config.ini', encoding='utf-8')
def convert_to_db():
source = import_from_xlsx.import_xlsx_path.get_()
destination = import_from_xlsx.destination_path.get_()
convert_xlsx_to_db.convert_database(source, destination)
import_from_xlsx.import_from_xlsx.destroy()
import_from_xlsx.import_browse_button.settings(\
command=lambda: import_from_xlsx.import_xlsx_path.set(filedialog.askopenfile().name))
import_from_xlsx.time_browse_button.settings(\
command=lambda: import_from_xlsx.time_xlsx_path.set(filedialog.askopenfile().name))
import_from_xlsx.destination_browse_button.settings(\
command=lambda: import_from_xlsx.destination_path.set(filedialog.asksaveasfilename() + '.db'))
import_from_xlsx.cancel_button.settings(command=import_from_xlsx.import_from_xlsx.destroy)
import_from_xlsx.import_button.settings(command=convert_to_db)
开发者ID:wasifzaman,项目名称:Project-RYB,代码行数:33,代码来源:import_from_xlsx_.py
示例2: findEEPath
def findEEPath(self):
if sys.platform[:3] == 'win': #for windows, wince, win32, etc
file=filedialog.askopenfile(filetypes=[("Programs","*.exe"),("All files","*")],title="Choose External Editor",parent=self)
else:
file=filedialog.askopenfile(filetypes=[("All files","*")],title="Choose External Editor",parent=self)
if file != None:
name = os.path.abspath(file.name)
file.close()
self.ee.delete(0,END)
self.ee.insert(END,name)
self.validate()
开发者ID:PerryZh,项目名称:asymptote,代码行数:11,代码来源:xasyOptionsDialog.py
示例3: findAsyPath
def findAsyPath(self):
if sys.platform[:3] == 'win': #for windows, wince, win32, etc
file=filedialog.askopenfile(filetypes=[("Programs","*.exe"),("All files","*")],title="Find Asymptote Executable",parent=self)
else:
file=filedialog.askopenfile(filetypes=[("All files","*")],title="Find Asymptote Executable",parent=self)
if file != None:
name = os.path.abspath(file.name)
file.close()
self.ap.delete(0,END)
self.ap.insert(END,name)
self.validate()
开发者ID:PerryZh,项目名称:asymptote,代码行数:11,代码来源:xasyOptionsDialog.py
示例4: load
def load(self):
fname = filedialog.askopenfile(parent=self, mode='rb', title='Choose a file', initialdir="./data")
self.db.load(fname.name)
for canvas in self.canvasi:
self.menubar.remove_item(canvas.name)
canvas.delete("all")
canvas.destroy()
self.canvasi = []
for name in self.db.names:
num = 0
canv = Canv(self, name)
self.canvasi.append(canv)
self.canvas_switch(name)
self.menubar.add_button("show", name, self.canvas_switch)
for node in self.db.nodes[name]:
cur = int(node[-1])
if cur > num:
num = cur
n = {}
n[node] = {}
n[node]["tags"] = self.db.tags[node].copy()
n[node]["text"] = self.db.text[node]
n[node]["coords"] = self.db.coords[node]
n[node]["links"] = self.db.links[node].copy()
canv.insert_sticker(node, n)
for i in range(num):
noname = numerate("Node")
for sticky in canv.stickies:
for other in canv.stickies[sticky].links:
canv.stickies[sticky].connect2box(other, True)
开发者ID:Exodus111,项目名称:Projects,代码行数:30,代码来源:main.py
示例5: run
def run():
Tk().withdraw() #dont need a console open
if sys.version_info[0] < 3:
zippath = tkFileDialog.askopenfile() #open up the file system and get the name
else:
zippath = filedialog.askopenfile()
clean(zippath.name)
开发者ID:ahavanur,项目名称:FIU,代码行数:7,代码来源:pit_clean.py
示例6: handleOpen
def handleOpen(self, event = None):
global width, height
# Einlesen der Daten
file = askopenfile(title = "Öffnen...",
defaultextension = ".cells",
filetypes = [("Plaintext-Dateien (*.cells)", "*.cells")])
f = open(file.name, "r")
content = f.read()
f.close()
# Datei in ihre Zeilen zerlegen
lines = content.strip().split("\n")
# Whitespace-Zeichen entfernen
lines = list(map(lambda line: list(line.strip()), lines))
# Alle Kommentar-Zeilen entfernen, die mit ! beginnen
data = list(filter(lambda line: line[0] != "!" if len(line) > 0 else True, lines))
# Aktualisieren von Breite und Höhe
# (Es werden zwei Zellen Rand auf allen Seiten hinzugefügt)
height = len(data) + 4
width = max(list(map(lambda line: len(line), data))) + 4
self.draw_grid()
# eingelesene Daten übernehmen
self.grid = [[0 for y in range(height)] for x in range(width)]
self.init_grid = [[0 for y in range(height)] for x in range(width)]
for y in range(len(data)):
for x in range(len(data[y])):
if data[y][x] != '.':
self.init_grid[x+2][y+2] = 1
self.handleReset()
开发者ID:malteschmitz,项目名称:gameoflife,代码行数:31,代码来源:gameoflife.py
示例7: load
def load(self, simFile=None):
from tkinter import Tk
from tkinter.filedialog import askopenfile
Tk().withdraw()
if simFile is None:
simFile = askopenfile(mode="rb", filetypes=[("Newton's Laboratory Simulation File", ".sim")])
if simFile is None:
return
data = pickle.load(simFile)
for group in data:
for obj in group:
obj.simulation = self
if isinstance(obj, Point):
print(obj.displacement)
self.bodies, self.constraints = data
self.planet = self.bodies[0]
for d in data:
for x in d:
print(x.__dict__)
开发者ID:Tochicool,项目名称:Newt,代码行数:25,代码来源:sim.py
示例8: getFileInput
def getFileInput():
root = Tk()
root.withdraw()
wordFile = filedialog.askopenfile(title="Open Word File", mode="r", parent=root)
if wordFile is None:
raise SystemExit
return wordFile
开发者ID:nalexander50,项目名称:Daily-Programmer,代码行数:7,代码来源:Hacking.py
示例9: open_file
def open_file():
textfield.delete("1.0", END)
file2open = filedialog.askopenfile(mode='r')
if file2open is None:
return
text2open = file2open.read()
textfield.insert("1.0", text2open)
开发者ID:rlenart360,项目名称:TextEditor,代码行数:7,代码来源:text_editor.py
示例10: load
def load():
global loadfile
global countload
loadfile[countload] = filedialog.askopenfile()
loadfile[countload] = str(loadfile[countload]).rsplit("/", 1)[1]
loadfile[countload] = str(loadfile[countload]).rsplit("'", 5)[0]
countload += 1
开发者ID:zsha2,项目名称:Conditioning,代码行数:7,代码来源:main.py
示例11: ChargerJeu
def ChargerJeu(self):
self.partie.historique = ""
self.historique.delete(1.0,END)
fileName = filedialog.askopenfile(filetypes=[("Save Games", "*.sav")])
self.partie.charger(fileName.name)
self.interface_damier.ActualiserPieces(True,False)
self.CalculPointage()
开发者ID:mircea-vutcovici,项目名称:interface,代码行数:7,代码来源:interfaceDames.py
示例12: load
def load(num):
global loadfile
loadfile[num] = filedialog.askopenfile()
if loadfile[num] != None:
if num == 1:
loadbutton1.config(bg = "#33FFFF")
if num == 2:
loadbutton2.config(bg = "#33FFFF")
if num == 3:
loadbutton3.config(bg = "#33FFFF")
if num == 4:
loadbutton4.config(bg = "#33FFFF")
if num == 5:
loadbutton5.config(bg = "#33FFFF")
if num == 6:
loadbutton6.config(bg = "#33FFFF")
if num == 7:
loadbutton7.config(bg = "#33FFFF")
if num == 8:
loadbutton8.config(bg = "#33FFFF")
if num == 9:
loadbutton9.config(bg = "#33FFFF")
if num == 10:
loadbutton10.config(bg = "#33FFFF")
loadfile[num] = str(loadfile[num]).rsplit("/", 1)[1]
loadfile[num] = str(loadfile[num]).rsplit("'", 5)[0]
开发者ID:zsha2,项目名称:Conditioning,代码行数:26,代码来源:main.py
示例13: main
def main():
root = Tk()
root.withdraw()
with filedialog.askopenfile(mode = "r", parent = root) as inputData:
students = []
for line in inputData:
firstName, lastName = line.split(',')
lastName = lastName.strip()
scores = []
scores = lastName.split(' ')
lastName = scores.pop(0)
while '' in scores:
scores.remove('')
for item in scores:
if ' ' in item:
if ' ' in item[:1]:
newItem = item[1:]
scores.insert(scores.index(item), newItem)
scores.remove(item)
item = newItem
if "100" in item:
first, second = item.split(' ')
first = first.strip()
second = second.strip()
scores.insert(scores.index(item), first)
scores.insert(scores.index(item) + 1, second)
scores.remove(item)
else:
scores[scores.index(item)] = item.replace(' ', '')
students.append(Student(firstName, lastName, scores))
students = sortList(students)
longestNameLen = findLongestName(students)
output(students, longestNameLen, os.path.basename(inputData.name))
开发者ID:nalexander50,项目名称:Daily-Programmer,代码行数:33,代码来源:Test+Scores.py
示例14: show_test_vad_open
def show_test_vad_open(self, path=path_to_test):
askopenfile = filedialog.askopenfile(filetypes=[("Wave audio files", "*.wav *.wave")], defaultextension=".wav",
initialdir=path)
if not askopenfile is None:
test(WavFile(askopenfile.name), self.nbc)
else:
messagebox.showwarning("Warning", "You should select one file. Please, try again")
开发者ID:KOlexandr,项目名称:Audio,代码行数:7,代码来源:Window.py
示例15: EXP_play_recreates
def EXP_play_recreates(self, event):
try:
f = filedialog.askopenfile(mode='r', defaultextension=".csv")
if f is None: # askopenfile return `None` if dialog closed with "cancel".
return
path_filenames = list()
for line in f:
fname = line.rstrip()
print("fname is: " + str(fname))
path_filenames.append(line.rstrip())
finally:
f.close()
print("after finally block")
# colors = ["red", "blue", "green"]
colors = ["red", "red", "red"]
c = 0
for path_file in path_filenames:
print("before EXP_open_path_from_file")
self.EXP_open_path_from_file(path_file)
print("after EXP_open_path_from_file")
print("before EXP_replay_path_from_file")
self.EXP_replay_path_from_file(colors[c%3])
print("after EXP_replay_path_from_file")
input("press to play next")
# time.sleep(2)
c += 1
if c%1 == 0:
self.do_clear_canvas()
开发者ID:joeliven,项目名称:lfd,代码行数:30,代码来源:gui.py
示例16: getBOMList
def getBOMList(self):
bFileTxt = filedialog.askopenfile(mode='r', **self.file_opt)
if bFileTxt != None:
self.parseFileName(str(bFileTxt))
bFileCsv = filedialog.asksaveasfile(mode='w', **self.wfile_opt)
if bFileCsv != None:
self.parseFileName(str(bFileCsv), fType='csv', mode=1)
self.toCSV(bFileTxt, bFileCsv, mode=1)
开发者ID:Aditya300,项目名称:FileConversions,代码行数:8,代码来源:TxtToCSV.py
示例17: open_file
def open_file():
global filename
file = askopenfile(parent=root, title='Open File')
filename = file.name
data = file.read()
text_area.delete(0.0, END)
text_area.insert(0.0, data)
file.close()
开发者ID:v4iv,项目名称:Peach,代码行数:8,代码来源:peach.py
示例18: restaureDico
def restaureDico(self):
"""Restauration du dictionnaire pour pourvoir lire et écrire dedans"""
fiSource = askopenfile(filetypes=[("Texte", ".txt"), ("Tous", "*")])
ligneListe = fiSource.readlines()
for ligne in ligneListe:
champsValeur = ligne.split()
self.dico[champsValeur[0]] = champsValeur[1]
fiSource.close()
开发者ID:Pampipampupampa,项目名称:Cours-Python,代码行数:8,代码来源:dicoCouleur.py
示例19: getNetList
def getNetList(self):
nFileTxt = filedialog.askopenfile(mode='r', **self.file_opt)
if nFileTxt != None:
self.parseFileName(str(nFileTxt))
nFileCsv = filedialog.asksaveasfile(mode='w', **self.wfile_opt)
if nFileCsv != None:
self.parseFileName(str(nFileCsv), fType='csv', mode=1)
self.toCSV(nFileTxt, nFileCsv)
开发者ID:Aditya300,项目名称:FileConversions,代码行数:8,代码来源:TxtToCSV.py
示例20: handleNotification
def handleNotification( self, notification ) :
if notification.getName( ) == Messages.FIND_FILES :
vo = notification.getBody()
dfile = filedialog.askopenfile( mode='r', title=vo.msg )
if dfile != None :
vo.path = dfile.name
vo.entry.delete( 0, END )
vo.entry.insert( 0, vo.path )
开发者ID:nephiw,项目名称:DNA-Sequencer,代码行数:8,代码来源:mediators.py
注:本文中的tkinter.filedialog.askopenfile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论