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

Method __init__

Lib/turtledemo/__main__.py:128–201  ·  view source on GitHub ↗
(self, filename=None)

Source from the content-addressed store, hash-verified

126class DemoWindow(object):
127
128 def __init__(self, filename=None):
129 self.root = root = turtle._root = Tk()
130 root.title('Python turtle-graphics examples')
131 root.wm_protocol("WM_DELETE_WINDOW", self._destroy)
132
133 if darwin:
134 import subprocess
135 # Make sure we are the currently activated OS X application
136 # so that our menu bar appears.
137 subprocess.run(
138 [
139 '/usr/bin/osascript',
140 '-e', 'tell application "System Events"',
141 '-e', 'set frontmost of the first process whose '
142 'unix id is {} to true'.format(os.getpid()),
143 '-e', 'end tell',
144 ],
145 stderr=subprocess.DEVNULL,
146 stdout=subprocess.DEVNULL,)
147
148 root.grid_rowconfigure(0, weight=1)
149 root.grid_columnconfigure(0, weight=1)
150 root.grid_columnconfigure(1, minsize=90, weight=1)
151 root.grid_columnconfigure(2, minsize=90, weight=1)
152 root.grid_columnconfigure(3, minsize=90, weight=1)
153
154 self.mBar = Menu(root, relief=RAISED, borderwidth=2)
155 self.mBar.add_cascade(menu=self.makeLoadDemoMenu(self.mBar),
156 label='Examples', underline=0)
157 self.mBar.add_cascade(menu=self.makeFontMenu(self.mBar),
158 label='Fontsize', underline=0)
159 self.mBar.add_cascade(menu=self.makeHelpMenu(self.mBar),
160 label='Help', underline=0)
161 root['menu'] = self.mBar
162
163 pane = PanedWindow(root, orient=HORIZONTAL, sashwidth=5,
164 sashrelief=SOLID, bg='#ddd')
165 pane.add(self.makeTextFrame(pane))
166 pane.add(self.makeGraphFrame(pane))
167 pane.grid(row=0, columnspan=4, sticky='news')
168
169 self.output_lbl = Label(root, height= 1, text=" --- ", bg="#ddf",
170 font=("Arial", 16, 'normal'), borderwidth=2,
171 relief=RIDGE)
172 if darwin: # Leave Mac button colors alone - #44254.
173 self.start_btn = Button(root, text=" START ", font=btnfont,
174 fg='#00cc22', command=self.startDemo)
175 self.stop_btn = Button(root, text=" STOP ", font=btnfont,
176 fg='#00cc22', command=self.stopIt)
177 self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
178 fg='#00cc22', command = self.clearCanvas)
179 else:
180 self.start_btn = Button(root, text=" START ", font=btnfont,
181 fg="white", disabledforeground = "#fed",
182 command=self.startDemo)
183 self.stop_btn = Button(root, text=" STOP ", font=btnfont,
184 fg="white", disabledforeground = "#fed",
185 command=self.stopIt)

Callers 1

makeGraphFrameMethod · 0.45

Calls 15

makeLoadDemoMenuMethod · 0.95
makeFontMenuMethod · 0.95
makeHelpMenuMethod · 0.95
addMethod · 0.95
makeTextFrameMethod · 0.95
makeGraphFrameMethod · 0.95
loadfileMethod · 0.95
configGUIMethod · 0.95
PercolatorClass · 0.90
ColorDelegatorClass · 0.90
TkClass · 0.85
MenuClass · 0.85

Tested by

no test coverage detected