class_docstr: Plot Examples
  =============
  
  See examples/advanced/pyglet_plotting.py for many more examples.
  
  >>> from sympy.plotting.pygletplot import PygletPlot as Plot
  >>> from sympy.abc import x, y, z
  
  >>> Plot(x*y**3-y*x**3)
  [0]: -x**3*y + x*y**3, 'mode=cartesian'
  
  >>> p = Plot()
  >>> p[1] = x*y
  >>> p[1].color = z, (0.4,0.4,0.9), (0.9,0.4,0.4)
  
  >>> p = Plot()
  >>> p[1] =  x**2+y**2
  >>> p[2] = -x**2-y**2
  
  
  Variable Intervals
  ==================
  
  The basic format is [var, min, max, steps], but the
  syntax is flexible and arguments left out are taken
  from the defaults for the current coordinate mode:
  
  >>> Plot(x**2) # implies [x,-5,5,100]
  [0]: x**2, 'mode=cartesian'
  >>> Plot(x**2, [], []) # [x,-1,1,40], [y,-1,1,40]
  [0]: x**2, 'mode=cartesian'
  >>> Plot(x**2-y**2, [100], [100]) # [x,-1,1,100], [y,-1,1,100]
  [0]: x**2 - y**2, 'mode=cartesian'
  >>> Plot(x**2, [x,-13,13,100])
  [0]: x**2, 'mode=cartesian'
  >>> Plot(x**2, [-13,13]) # [x,-13,13,100]
  [0]: x**2, 'mode=cartesian'
  >>> Plot(x**2, [x,-13,13]) # [x,-13,13,10]
  [0]: x**2, 'mode=cartesian'
  >>> Plot(1*x, [], [x], mode='cylindrical')
  ... # [unbound_theta,0,2*Pi,40], [x,-1,1,20]
  [0]: x, 'mode=cartesian'
  
  
  Coordinate Modes
  ================
  
  Plot supports several curvilinear coordinate modes, and
  they independent for each plotted function. You can specify
  a coordinate mode explicitly with the 'mode' named argument,
  but it can be automatically determined for Cartesian or
  parametric plots, and therefore must only be specified for
  polar, cylindrical, and spherical modes.
  
  Specifically, Plot(function arguments) and Plot[n] =
  (function arguments) will interpret your arguments as a
  Cartesian plot if you provide one function and a parametric
  plot if you provide two or three functions. Similarly, the
  arguments will be interpreted as a curve if one variable is
  used, and a surface if two are used.
  
  Supported mode names by number of variables:
  
  1: parametric, cartesian, polar
  2: parametric, cartesian, cylindrical = polar, spherical
  
  >>> Plot(1, mode='spherical')
  
  
  Calculator-like Interface
  =========================
  
  >>> p = Plot(visible=False)
  >>> f = x**2
  >>> p[1] = f
  >>> p[2] = f.diff(x)
  >>> p[3] = f.diff(x).diff(x)
  >>> p
  [1]: x**2, 'mode=cartesian'
  [2]: 2*x, 'mode=cartesian'
  [3]: 2, 'mode=cartesian'
  >>> p.show()
  >>> p.clear()
  >>> p
  <blank plot>
  >>> p[1] =  x**2+y**2
  >>> p[1].style = 'solid'
  >>> p[2] = -x**2-y**2
  >>> p[2].style = 'wireframe'
  >>> p[1].color = z, (0.4,0.4,0.9), (0.9,0.4,0.4)
  >>> p[1].style = 'both'
  >>> p[2].style = 'both'
  >>> p.close()
  
  
  Plot Window Keyboard Controls
  =============================
  
  Screen Rotation:
      X,Y axis      Arrow Keys, A,S,D,W, Numpad 4,6,8,2
      Z axis        Q,E, Numpad 7,9
  
  Model Rotation:
      Z axis        Z,C, Numpad 1,3
  
  Zoom:             R,F, PgUp,PgDn, Numpad +,-
  
  Reset Camera:     X, Numpad 5
  
  Camera Presets:
      XY            F1
      XZ            F2
      YZ            F3
      Perspective   F4
  
  Sensitivity Modifier: SHIFT
  
  Axes Toggle:
      Visible       F5
      Colors        F6
  
  Close Window:     ESCAPE
  
  =============================
docstr: Positional Arguments
  ====================
  
  Any given positional arguments are used to
  initialize a plot function at index 1. In
  other words...
  
  >>> from sympy.plotting.pygletplot import PygletPlot as Plot
  >>> from sympy.abc import x
  >>> p = Plot(x**2, visible=False)
  
  ...is equivalent to...
  
  >>> p = Plot(visible=False)
  >>> p[1] = x**2
  
  Note that in earlier versions of the plotting
  module, you were able to specify multiple
  functions in the initializer. This functionality
  has been dropped in favor of better automatic
  plot plot_mode detection.
  
  
  Named Arguments
  ===============
  
  axes
      An option string of the form
      "key1=value1; key2 = value2" which
      can use the following options:
  
      style = ordinate
          none OR frame OR box OR ordinate
  
      stride = 0.25
          val OR (val_x, val_y, val_z)
  
      overlay = True (draw on top of plot)
          True OR False
  
      colored = False (False uses Black,
                       True uses colors
                       R,G,B = X,Y,Z)
          True OR False
  
      label_axes = False (display axis names
                          at endpoints)
          True OR False
  
  visible = True (show immediately
      True OR False
  
  
  The following named arguments are passed as
  arguments to window initialization:
  
  antialiasing = True
      True OR False
  
  ortho = False
      True OR False
  
  invert_mouse_zoom = False
      True OR False
docstr_tok: ["Positional","Arguments","====================","Any","given","positional","arguments","are","used","to","initialize","a","plot","function","at","index","1",".","In","other","words","...",">",">",">","from","sympy.plotting.pygletplot","import","PygletPlot","as","Plot",">",">",">","from","sympy.abc","import","x",">",">",">","p","=","Plot","(","x","*","*","2",",","visible=False",")","...","is","equivalent","to","...",">",">",">","p","=","Plot","(","visible=False",")",">",">",">","p","[","1","]","=","x","*","*","2","Note","that","in","earlier","versions","of","the","plotting","module",",","you","were","able","to","specify","multiple","functions","in","the","initializer",".","This","functionality","has","been","dropped","in","favor","of","better","automatic","plot","plot_mode","detection",".","Named","Arguments","===============","axes","An","option","string","of","the","form","``","key1=value1",";","key2","=","value2","''","which","can","use","the","following","options",":","style","=","ordinate","none","OR","frame","OR","box","OR","ordinate","stride","=","0.25","val","OR","(","val_x",",","val_y",",","val_z",")","overlay","=","True","(","draw","on","top","of","plot",")","True","OR","False","colored","=","False","(","False","uses","Black",",","True","uses","colors","R",",","G",",","B","=","X",",","Y",",","Z",")","True","OR","False","label_axes","=","False","(","display","axis","names","at","endpoints",")","True","OR","False","visible","=","True","(","show","immediately","True","OR","False","The","following","named","arguments","are","passed","as","arguments","to","window","initialization",":","antialiasing","=","True","True","OR","False","ortho","=","False","True","OR","False","invert_mouse_zoom","=","False","True","OR","False"]
code: def __init__(self, *fargs, **win_args):
      """
      Positional Arguments
      ====================
  
      Any given positional arguments are used to
      initialize a plot function at index 1. In
      other words...
  
      >>> from sympy.plotting.pygletplot import PygletPlot as Plot
      >>> from sympy.abc import x
      >>> p = Plot(x**2, visible=False)
  
      ...is equivalent to...
  
      >>> p = Plot(visible=False)
      >>> p[1] = x**2
  
      Note that in earlier versions of the plotting
      module, you were able to specify multiple
      functions in the initializer. This functionality
      has been dropped in favor of better automatic
      plot plot_mode detection.
  
  
      Named Arguments
      ===============
  
      axes
          An option string of the form
          "key1=value1; key2 = value2" which
          can use the following options:
  
          style = ordinate
              none OR frame OR box OR ordinate
  
          stride = 0.25
              val OR (val_x, val_y, val_z)
  
          overlay = True (draw on top of plot)
              True OR False
  
          colored = False (False uses Black,
                           True uses colors
                           R,G,B = X,Y,Z)
              True OR False
  
          label_axes = False (display axis names
                              at endpoints)
              True OR False
  
      visible = True (show immediately
          True OR False
  
  
      The following named arguments are passed as
      arguments to window initialization:
  
      antialiasing = True
          True OR False
  
      ortho = False
          True OR False
  
      invert_mouse_zoom = False
          True OR False
  
      """
      # Register the plot modes
      from . import plot_modes  # noqa
  
      self._win_args = win_args
      self._window = None
  
      self._render_lock = RLock()
  
      self._functions = {}
      self._pobjects = []
      self._screenshot = ScreenShot(self)
  
      axe_options = parse_option_string(win_args.pop("axes", ""))
      self.axes = PlotAxes(**axe_options)
      self._pobjects.append(self.axes)
  
      self[0] = fargs
      if win_args.get("visible", True):
          self.show()
  
imports: from threading import RLock
  from sympy.core.numbers import Integer
  from sympy.external.gmpy import SYMPY_INTS
  from sympy.geometry.entity import GeometryEntity
  from sympy.plotting.pygletplot.plot_axes import PlotAxes
  from sympy.plotting.pygletplot.plot_mode import PlotMode
  from sympy.plotting.pygletplot.plot_object import PlotObject
  from sympy.plotting.pygletplot.plot_window import PlotWindow
  from sympy.plotting.pygletplot.util import parse_option_string
  from sympy.utilities.decorator import doctest_depends_on
  from sympy.utilities.iterables import is_sequence
  from time import sleep
  from os import getcwd, listdir
  import ctypes
label_desc: Use image node_id 1 to create a new PygletPlot object  with example: obj = PygletPlot()