MCPcopy Index your code
hub / github.com/python/cpython / Open

Class Open

Lib/tkinter/filedialog.py:332–349  ·  view source on GitHub ↗

Ask for a filename to open

Source from the content-addressed store, hash-verified

330# file dialogs
331
332class Open(_Dialog):
333 "Ask for a filename to open"
334
335 command = "tk_getOpenFile"
336
337 def _fixresult(self, widget, result):
338 if isinstance(result, tuple):
339 # multiple results:
340 result = tuple([getattr(r, "string", r) for r in result])
341 if result:
342 path, file = os.path.split(result[0])
343 self.options["initialdir"] = path
344 # don't set initialfile or filename, as we have multiple of these
345 return result
346 if not widget.tk.wantobjects() and "multiple" in self.options:
347 # Need to split result explicitly
348 return self._fixresult(widget, widget.tk.splitlist(result))
349 return _Dialog._fixresult(self, widget, result)
350
351
352class SaveAs(_Dialog):

Callers 3

askopenfilenameFunction · 0.70
askopenfilenamesFunction · 0.70
askopenfileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…