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

Method __init__

Lib/tkinter/filedialog.py:58–120  ·  view source on GitHub ↗
(self, master, title=None)

Source from the content-addressed store, hash-verified

56 title = "File Selection Dialog"
57
58 def __init__(self, master, title=None):
59 if title is None: title = self.title
60 self.master = master
61 self.directory = None
62
63 self.top = Toplevel(master)
64 self.top.title(title)
65 self.top.iconname(title)
66 _setup_dialog(self.top)
67
68 self.botframe = Frame(self.top)
69 self.botframe.pack(side=BOTTOM, fill=X)
70
71 self.selection = Entry(self.top)
72 self.selection.pack(side=BOTTOM, fill=X)
73 self.selection.bind('<Return>', self.ok_event)
74
75 self.filter = Entry(self.top)
76 self.filter.pack(side=TOP, fill=X)
77 self.filter.bind('<Return>', self.filter_command)
78
79 self.midframe = Frame(self.top)
80 self.midframe.pack(expand=YES, fill=BOTH)
81
82 self.filesbar = Scrollbar(self.midframe)
83 self.filesbar.pack(side=RIGHT, fill=Y)
84 self.files = Listbox(self.midframe, exportselection=0,
85 yscrollcommand=(self.filesbar, 'set'))
86 self.files.pack(side=RIGHT, expand=YES, fill=BOTH)
87 btags = self.files.bindtags()
88 self.files.bindtags(btags[1:] + btags[:1])
89 self.files.bind('<ButtonRelease-1>', self.files_select_event)
90 self.files.bind('<Double-ButtonRelease-1>', self.files_double_event)
91 self.filesbar.config(command=(self.files, 'yview'))
92
93 self.dirsbar = Scrollbar(self.midframe)
94 self.dirsbar.pack(side=LEFT, fill=Y)
95 self.dirs = Listbox(self.midframe, exportselection=0,
96 yscrollcommand=(self.dirsbar, 'set'))
97 self.dirs.pack(side=LEFT, expand=YES, fill=BOTH)
98 self.dirsbar.config(command=(self.dirs, 'yview'))
99 btags = self.dirs.bindtags()
100 self.dirs.bindtags(btags[1:] + btags[:1])
101 self.dirs.bind('<ButtonRelease-1>', self.dirs_select_event)
102 self.dirs.bind('<Double-ButtonRelease-1>', self.dirs_double_event)
103
104 self.ok_button = Button(self.botframe,
105 text="OK",
106 command=self.ok_command)
107 self.ok_button.pack(side=LEFT)
108 self.filter_button = Button(self.botframe,
109 text="Filter",
110 command=self.filter_command)
111 self.filter_button.pack(side=LEFT, expand=YES)
112 self.cancel_button = Button(self.botframe,
113 text="Cancel",
114 command=self.cancel_command)
115 self.cancel_button.pack(side=RIGHT)

Callers

nothing calls this directly

Calls 13

ToplevelClass · 0.90
_setup_dialogFunction · 0.90
FrameClass · 0.90
EntryClass · 0.90
ScrollbarClass · 0.90
ListboxClass · 0.90
ButtonClass · 0.90
bindtagsMethod · 0.80
protocolMethod · 0.80
titleMethod · 0.45
packMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected