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

Method exitonclick

Lib/turtle.py:3915–3943  ·  view source on GitHub ↗

Go into mainloop until the mouse is clicked. No arguments. Bind bye() method to mouseclick on TurtleScreen. If "using_IDLE" - value in configuration dictionary is False (default value), enter mainloop. If IDLE with -n switch (no subprocess) is used, this val

(self)

Source from the content-addressed store, hash-verified

3913 self._destroy()
3914
3915 def exitonclick(self):
3916 """Go into mainloop until the mouse is clicked.
3917
3918 No arguments.
3919
3920 Bind bye() method to mouseclick on TurtleScreen.
3921 If "using_IDLE" - value in configuration dictionary is False
3922 (default value), enter mainloop.
3923 If IDLE with -n switch (no subprocess) is used, this value should be
3924 set to True in turtle.cfg. In this case IDLE's mainloop
3925 is active also for the client script.
3926
3927 This is a method of the Screen-class and not available for
3928 TurtleScreen instances.
3929
3930 Example (for a Screen instance named screen):
3931 >>> screen.exitonclick()
3932
3933 """
3934 def exitGracefully(x, y):
3935 """Screen.bye() with two dummy-parameters"""
3936 self.bye()
3937 self.onclick(exitGracefully)
3938 if _CFG["using_IDLE"]:
3939 return
3940 try:
3941 mainloop()
3942 except AttributeError:
3943 exit(0)
3944
3945class Turtle(RawTurtle):
3946 """RawTurtle auto-creating (scrolled) canvas.

Callers

nothing calls this directly

Calls 3

mainloopFunction · 0.85
exitFunction · 0.50
onclickMethod · 0.45

Tested by

no test coverage detected