MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / DemoWindow

Class DemoWindow

tools/python-3.11.9-amd64/Lib/turtledemo/__main__.py:127–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected