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

Method __init__

Lib/tkinter/simpledialog.py:99–148  ·  view source on GitHub ↗

Initialize a dialog. Arguments: parent -- a parent window (the application window) title -- the dialog title

(self, parent, title = None)

Source from the content-addressed store, hash-verified

97 '''
98
99 def __init__(self, parent, title = None):
100 '''Initialize a dialog.
101
102 Arguments:
103
104 parent -- a parent window (the application window)
105
106 title -- the dialog title
107 '''
108 master = parent
109 if master is None:
110 master = _get_temp_root()
111
112 Toplevel.__init__(self, master)
113
114 self.withdraw() # remain invisible for now
115 # If the parent is not viewable, don't
116 # make the child transient, or else it
117 # would be opened withdrawn
118 if parent is not None and parent.winfo_viewable():
119 self.transient(parent)
120
121 if title:
122 self.title(title)
123
124 _setup_dialog(self)
125
126 self.parent = parent
127
128 self.result = None
129
130 body = Frame(self)
131 self.initial_focus = self.body(body)
132 body.pack(padx=5, pady=5)
133
134 self.buttonbox()
135
136 if self.initial_focus is None:
137 self.initial_focus = self
138
139 self.protocol("WM_DELETE_WINDOW", self.cancel)
140
141 _place_window(self, parent)
142
143 self.initial_focus.focus_set()
144
145 # wait for window to appear on screen before calling grab_set
146 self.wait_visibility()
147 self.grab_set()
148 self.wait_window(self)
149
150 def destroy(self):
151 '''Destroy the window'''

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 14

bodyMethod · 0.95
buttonboxMethod · 0.95
_get_temp_rootFunction · 0.90
FrameClass · 0.90
_setup_dialogFunction · 0.85
_place_windowFunction · 0.85
winfo_viewableMethod · 0.80
protocolMethod · 0.80
wait_visibilityMethod · 0.80
grab_setMethod · 0.80
wait_windowMethod · 0.80
titleMethod · 0.45

Tested by

no test coverage detected