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

Method go

Lib/tkinter/filedialog.py:122–145  ·  view source on GitHub ↗
(self, dir_or_file=os.curdir, pattern="*", default="", key=None)

Source from the content-addressed store, hash-verified

120 self.top.bind('<Alt-W>', self.cancel_command)
121
122 def go(self, dir_or_file=os.curdir, pattern="*", default="", key=None):
123 if key and key in dialogstates:
124 self.directory, pattern = dialogstates[key]
125 else:
126 dir_or_file = os.path.expanduser(dir_or_file)
127 if os.path.isdir(dir_or_file):
128 self.directory = dir_or_file
129 else:
130 self.directory, default = os.path.split(dir_or_file)
131 self.set_filter(self.directory, pattern)
132 self.set_selection(default)
133 self.filter_command()
134 self.selection.focus_set()
135 self.top.wait_visibility() # window needs to be visible for the grab
136 self.top.grab_set()
137 self.how = None
138 self.master.mainloop() # Exited by self.quit(how)
139 if key:
140 directory, pattern = self.get_filter()
141 if self.how:
142 directory = os.path.dirname(self.how)
143 dialogstates[key] = directory, pattern
144 self.top.destroy()
145 return self.how
146
147 def quit(self, how=None):
148 self.how = how

Callers 1

testFunction · 0.45

Calls 13

set_filterMethod · 0.95
set_selectionMethod · 0.95
filter_commandMethod · 0.95
get_filterMethod · 0.95
expanduserMethod · 0.80
wait_visibilityMethod · 0.80
grab_setMethod · 0.80
isdirMethod · 0.45
splitMethod · 0.45
focus_setMethod · 0.45
mainloopMethod · 0.45
dirnameMethod · 0.45

Tested by

no test coverage detected