
    i>>             
       
   S SK JrJrJr  SrS SKrS SKrS SKrS SKrS SK	r	S SK
r
S SKrS SKrS SKJr   " S S\5      r " S S\5      r " S	 S
\5      r\R&                  S    S:X  d  \R&                  S S S;   a  S SKJr  OS SKJr   S SKJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4   S SK7J8r8J9r9J:r:J;r;  S r= S SK>r>S SK>J?r?J@r@JArAJBrB  \=S 5       rC\>R                  R                  \ClD        \=S 5       rE\>R                  R                  \ElD        \=S 5       rF\>R                  R                  \FlD        \=S 5       rG\>R                  R                  \GlD        \=S 5       rH\>R                  R                  \HlD        \=S 5       rI\>R                  R                  \IlD         S SKKrKS rLSnS jrM\R                  S:X  a   S SKNJOrOJPrPJQrQJRrRJSrSJTrTJUrU  / S!QrW\WrXS"rYS#rZS$r[S%r\S&r]S'r^S(r_S) r`\R                  R                  S*5      (       a  \b" S+5      e\R                  S,:X  a  S-S.KcJdre  OM\R                  S:X  a  S-S/KcJfre  O6\
R                  " 5       S0:X  a  S-S1KcJhre  O\b" S2\
R                  " 5       -  5      eS3riS4rjS3qkS5rlS6rmS7/rnS8roS9rp/ rq\R                  " S:S;5      rs\R                  " S<S=5      rtS> ruS? rvS@ rwSA rxSB rySoSC jrzSpSD jr{SE r|\|r}SnSF jr~ SG r\uSS\\SH\wSS64SI j5       r\uSS\\SH\wSS64SJ j5       r\uSSS-SH\\SH\wSS64	SK j5       r\uSSSHSH\wSS64SL j5       r\uSSSHSH\wSS64SM j5       r\uSSSHSH\wSS64SN j5       r\uSSSH\YSH\wSS64SO j5       r\uSSSH\YSH\wSS64SP j5       r\uSqSQ j5       r\uSqSR j5       r\uSqSS j5       r\uSSSH\wS8S64ST j5       r\uSSSH\wS8S64SU j5       r\r\uSSSH\w\\SS6S64SV j5       r\uS S SH\w\\SS6S64SW j5       r\r\wS4SX jrSY r\uSrSZ j5       r\uSrS[ j5       r\uSsS\ j5       r\\uSrS] j5       5       r\uStS^ j5       r\r\uS_ 5       r\rS` rS7Sa jrSuSb jrSc rSd rSe rSf rSg rSh rSi rSj rSnSk jrSvSl jrSm r\|" 5       u  rr\nGRW                  S \S--
  4\S--
  S 4\S--
  \S--
  4/5        g! \5 aC    S r6\6r\6r\6r\6r\6r\6r\6r\6r\6r\6r \6r!\6r"\6r#\6r$\6r%\6r&\6r'\6r(\6r)\6r*\6r+\6r,\6r-\6r.\6r/\6r0\6r1\6r2\6r3\6r4 GNf = f! \5 a    S r<\<=r8=r9=r:r; GNf = f! \5 a    S rJ\Jr?\JrC\JrE\JrF\JrG\JrH\JrI\Jr@\JrA\JrB GNZf = f! \5 a    S rL GNbf = f! \5 a    S  rV\VrO\VrP\VrQ\VrR\VrS\VrT\VrU GNXf = f)w    )absolute_importdivisionprint_functionz0.9.54N)contextmanagerc                       \ rS rSrSrSrg)PyAutoGUIException   a   
PyAutoGUI code will raise this exception class for any invalid actions. If PyAutoGUI raises some other exception,
you should assume that this is caused by a bug in PyAutoGUI itself. (Including a failure to catch potential
exceptions raised by PyAutoGUI.)
 N__name__
__module____qualname____firstlineno____doc____static_attributes__r
       ?C:\des-py\RoboSAPF\venv\Lib\site-packages\pyautogui/__init__.pyr   r           	r   r   c                       \ rS rSrSrSrg)FailSafeException'   a  
This exception is raised by PyAutoGUI functions when the user puts the mouse cursor into one of the "failsafe
points" (by default, one of the four corners of the primary monitor). This exception shouldn't be caught; it's
meant to provide a way to terminate a misbehaving script.
r
   Nr   r
   r   r   r   r   '   r   r   r   c                       \ rS rSrSrSrg)ImageNotFoundException1   z
This exception is the PyAutoGUI version of PyScreeze's `ImageNotFoundException`, which is raised when a locate*()
function call is unable to find an image.

Ideally, `pyscreeze.ImageNotFoundException` should never be raised by PyAutoGUI.
r
   Nr   r
   r   r   r   r   1   s    r   r      ))      )r   r   )Sequence)
easeInQuadeaseOutQuadeaseInOutQuadeaseInCubiceaseOutCubiceaseInOutCubiceaseInQuarteaseOutQuarteaseInOutQuarteaseInQuinteaseOutQuinteaseInOutQuint
easeInSineeaseOutSineeaseInOutSine
easeInExpoeaseOutExpoeaseInOutExpo
easeInCirceaseOutCirceaseInOutCirceaseInElasticeaseOutElasticeaseInOutElastic
easeInBackeaseOutBackeaseInOutBackeaseInBounceeaseOutBounceeaseInOutBouncec                      [        S5      e)z
This function raises ``PyAutoGUIException``. It's used for the PyTweening function names if the PyTweening
module failed to be imported.
zoPyAutoGUI was unable to import pytweening. Please install this module to enable the function you tried to call.r   unused_argsunused_kwargss     r   _couldNotImportPyTweeningrB   i   s    
 !}
 	
r   )alertconfirmpromptpasswordc                      [        S5      e)z
This function raises ``PyAutoGUIException``. It's used for the PyMsgBox function names if the PyMsgbox module
failed to be imported.
zmPyAutoGUI was unable to import pymsgbox. Please install this module to enable the function you tried to call.r>   r?   s     r   _couldNotImportPyMsgBoxrH      s    
 !{
 	
r   c                 F   ^  [         R                  " T 5      U 4S j5       nU$ )z
A decorator that wraps PyScreeze locate*() functions so that the PyAutoGUI user sees them raise PyAutoGUI's
ImageNotFoundException rather than PyScreeze's ImageNotFoundException. This is because PyScreeze should be
invisible to PyAutoGUI users.
c                  R   >  T" U 0 UD6$ ! [         R                   a    [        ef = fN)	pyscreezer   )argskwargswrappedFunctions     r   wrapper5raisePyAutoGUIImageNotFoundException.<locals>.wrapper   s3    	)"D3F33// 	)((	)s    &	functoolswrapsrO   rP   s   ` r   $raisePyAutoGUIImageNotFoundExceptionrV      s'     ___%) &) Nr   )centerpixelpixelMatchesColor
screenshotc                  .    [         R                  " U 0 UD6$ rK   )rL   locaterM   rN   s     r   r\   r\      s    000r   c                  .    [         R                  " U 0 UD6$ rK   )rL   	locateAllr]   s     r   r_   r_      s    ""D3F33r   c                  .    [         R                  " U 0 UD6$ rK   )rL   locateAllOnScreenr]   s     r   ra   ra      s    **D;F;;r   c                  .    [         R                  " U 0 UD6$ rK   )rL   locateCenterOnScreenr]   s     r   rc   rc      s    --t>v>>r   c                  .    [         R                  " U 0 UD6$ rK   )rL   locateOnScreenr]   s     r   re   re          ''888r   c                  .    [         R                  " U 0 UD6$ rK   )rL   locateOnWindowr]   s     r   rh   rh      rf   r   c                      [        S5      e)z
This function raises ``PyAutoGUIException``. It's used for the PyScreeze function names if the PyScreeze module
failed to be imported.
zPyAutoGUI was unable to import pyscreeze. (This is likely because you're running a version of Python that Pillow (which pyscreeze depends on) doesn't support currently.) Please install this module to enable the function you tried to call.r>   )r@   unsed_kwargss     r   _couldNotImportPyScreezerk      s    
 ! }
 	
r   c                  .    [         R                  " 5         g)z
Launches the MouseInfo app. This application provides mouse coordinate information which can be useful when
planning GUI automation tasks. This function blocks until the application is closed.
N)	mouseinfoMouseInfoWindowr
   r   r   	mouseInforo      s    
 	!!#r   c                      [        S5      e)z
This function raises PyAutoGUIException. It's used for the MouseInfo function names if the MouseInfo module
failed to be imported.
znPyAutoGUI was unable to import mouseinfo. Please install this module to enable the function you tried to call.r>   r
   r   r   ro   ro     s    
 !|
 	
r   c                 X    U c  Sn  U [         l        g! [         a    [        S5      ef = f)a  
When called with no arguments, PyAutoGUI will raise ImageNotFoundException when the PyScreeze locate*() functions
can't find the image it was told to locate. The default behavior is to return None. Call this function with no
arguments (or with True as the argument) to have exceptions raised, which is a better practice.

You can also disable raising exceptions by passing False for the argument.
NTzDuseImageNotFoundException() ws called but pyscreeze isn't installed.)rL   USE_IMAGE_NOT_FOUND_EXCEPTION	NameErrorr   )values    r   useImageNotFoundExceptionru     s9     }i27	/ i !ghhis    )win32)WindowgetActiveWindowgetActiveWindowTitlegetWindowsAtgetWindowsWithTitlegetAllWindowsgetAllTitlesc                      [        S5      e)z
This function raises PyAutoGUIException. It's used for the PyGetWindow function names if the PyGetWindow
module failed to be imported.
zpPyAutoGUI was unable to import pygetwindow. Please install this module to enable the function you tried to call.r>   r?   s     r   _couldNotImportPyGetWindowr   )  s    
 % C r   )	
 !"#$%&'()*+,-./0123456789:;<=>?@[\]^_`abcdefghijklmnopqrstuvwxyz{|}~acceptaddaltaltleftaltrightapps	backspacebrowserbackbrowserfavoritesbrowserforwardbrowserhomebrowserrefreshbrowsersearchbrowserstopcapslockclearconvertctrlctrlleft	ctrlrightdecimaldeldeletedividedownendenterescescapeexecutef1f10f11f12f13f14f15f16f17f18f19f2f20f21f22f23f24f3f4f5f6f7f8f9finalfnhanguelhangulhanjahelphomeinsertjunjakanakanji
launchapp1
launchapp2
launchmaillaunchmediaselectleft
modechangemultiply	nexttrack
nonconvertnum0num1num2num3num4num5num6num7num8num9numlockpagedownpageuppausepgdnpgup	playpause	prevtrackprintprintscreenprntscrnprtscprtscrreturnright
scrolllockselect	separatorshift	shiftleft
shiftrightsleepspacestopsubtracttabup
volumedown
volumemutevolumeupwinwinleftwinrightyencommandoption
optionleftoptionrightr  middler*  primary	secondaryz^`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?z^=1234567890/0qwertzuiop89-asdfghjkl,\yxcvbnm,.7+!@#$%^&*()?)QWERTZUIOP*(_ASDFGHJKL<|YXCVBNM<>&c                 L    U R                  5       =(       d    U [        S5      ;   $ )z
Returns True if the ``character`` is a keyboard key that would require the shift key to be held down, such as
uppercase letters or the symbols on the keyboard's number row.
z~!@#$%^&*()_+{}|:"<>?)isupperset)	characters    r   isShiftCharacterrI    s#     K)s3J/K"KKr   javaz)Jython is not yet supported by PyAutoGUI.darwinr   )_pyautogui_osx)_pyautogui_winLinux)_pyautogui_x11z1Your platform (%s) is not supported by PyAutoGUI.g?g?g{Gz?T)r   r   F
   Pointzx ySizezwidth heightc                 F   ^  [         R                  " T 5      U 4S j5       nU$ )zc
A decorator that calls failSafeCheck() before the decorated function and
_handlePause() after it.
c                  b   > [        5         T" U 0 UD6n[        UR                  SS5      5        U$ )N_pauseT)failSafeCheck_handlePauseget)rM   rN   	returnValrO   s      r   rP   (_genericPyAutoGUIChecks.<locals>.wrapperO  s0    #T4V4	VZZ$/0r   rR   rU   s   ` r   _genericPyAutoGUIChecksr[  I  s'     ___% & Nr   c                 0    X -
  U-  U -   nX1-
  U-  U-   nXV4$ )a  
Returns an (x, y) tuple of the point that has progressed a proportion ``n`` along the line defined by the two
``x1``, ``y1`` and ``x2``, ``y2`` coordinates.

This function was copied from pytweening module, so that it can be called even if PyTweening is not installed.
r
   )x1y1x2y2r   r   r   s          r   getPointOnLinera  ]  s+     'Q"A
'Q"A6Mr   c                 :    SU s=::  a  S::  d  O  [        S5      eU $ )a	  
Returns ``n``, where ``n`` is the float argument between ``0.0`` and ``1.0``. This function is for the default
linear tween for mouse moving functions.

This function was copied from PyTweening module, so that it can be called even if PyTweening is not installed.
        g      ?z%Argument must be between 0.0 and 1.0.r>   )r   s    r   linearrd  i  s      !?s? !HIIHr   c                     U (       aO  [        [        [        5      (       d  [        [        [        5      (       d   e[        R
                  " [        5        gg)z
A helper function for performing a pause at the end of a PyAutoGUI function based on some settings.

If ``_pause`` is ``True``, then sleep for ``PAUSE`` seconds (the global pause setting).
N)
isinstancePAUSEintfloattimer1  rU  s    r   rW  rW  w  s7     %%%E5)A)AAA

5 r   c                    U c  Uc
  [        5       $ U c,  Ub)  [        [        [        5       S   5      [        U5      5      $ UcA  U b>  [        U [        5      (       d)  [        [        U 5      [        [        5       S   5      5      $ [        U [
        5      (       a   [        U 5      nUb  [        U5      $ g[        U [        5      (       a  [        U 5      S:X  aJ  Uc$  [        [        U S   5      [        U S   5      5      $ [        SR                  [        U5      5      5      e[        U 5      S:X  a1  Uc  [        U 5      $ [        SR                  [        U5      5      5      e[        SR                  [        U 5      5      5      e[        [        U 5      [        U5      5      $ ! [        R                   a    [        ef = f)	a  
Returns a ``Point`` object based on ``firstArg`` and ``secondArg``, which are the first two arguments passed to
several PyAutoGUI functions. If ``firstArg`` and ``secondArg`` are both ``None``, returns the current mouse cursor
position.

``firstArg`` and ``secondArg`` can be integers, a sequence of integers, or a string representing an image filename
to find on the screen (and return the center coordinates of).
Nr   r   r   zRWhen passing a sequence for firstArg, secondArg must not be passed (received {0}).   zfWhen passing a sequence for firstArg, secondArg must not be passed and default to None (received {0}).zTThe supplied sequence must have exactly 2 or exactly 4 elements ({0} were received).)positionrQ  rh  rf  r   strre   rW   rL   r   lenr   formatrepr)firstArg	secondArglocations      r   _normalizeXYArgsrv    s    I-z		i3SA'Y88		x3JxQY<Z<ZS]C
1$677	Hc	"	"		)%h/H #h'' 
Hh	'	'x=A S!-s8A;/?@@(hooY 
 ]a h''(|  D  DY  %fmmM  S]C	N33C // 	)((	)s   F# #F>c                 *   U (       d  gU c
  [         SL a  g[        U5      S:  a  USS S-   n[        R                  R                  5       nUR                  < S[        UR                  5      R                  SS5      < S[        UR                  5      R                  SS5      < SUR                  < SUR                  < SUR                  < S[        UR                  5      SS	 < SU< SU< S
3n[        R                  R                  X55      n[         bY  [        ["        5      [         :  aB  [        R$                  " [        R                  R                  U["        S   5      5        ["        S	 ['        U5        ["        R)                  U5        g)a  
A helper function that creates a screenshot to act as a logging mechanism. When a PyAutoGUI function is called,
this function is also called to capture the state of the screen when that function was called.

If ``logScreenshot`` is ``False`` (or None and the ``LOG_SCREENSHOTS`` constant is ``False``), no screenshot is taken.

The ``funcName`` argument is a string of the calling function's name. It's used in the screenshot's filename.

The ``funcArgs`` argument is a string describing the arguments passed to the calling function. It's limited to
twelve characters to keep it short.

The ``folder`` argument is the folder to place the screenshot file in, and defaults to the current working directory.
NF   z...r   r   r   r   r   .pngr   )LOG_SCREENSHOTSrp  datetimenowyearro  monthrjustdayhourminutesecondmicrosecondospathjoinLOG_SCREENSHOTS_LIMITG_LOG_SCREENSHOTS_FILENAMESunlinkrZ   append)logScreenshotfuncNamefuncArgsfolderr|  filenamefilepaths          r   _logScreenshotr    s!    E!9 8}rCR=5(





!CCIIQ$CGG1c"



COORa 
H ww||F-H 	)4O0PTi0i
		"'',,v'B1'EFG'*x&&x0r   c                     [         R                  " 5       u  p#[        U5      n[        U5      nU b  [        U 5      nUb  [        U5      n[        X#5      $ )a  
Returns the current xy coordinates of the mouse cursor as a two-integer tuple.

Args:
  x (int, None, optional) - If not None, this argument overrides the x in
    the return value.
  y (int, None, optional) - If not None, this argument overrides the y in
    the return value.

Returns:
  (x, y) tuple of the current xy coordinates of the mouse cursor.

NOTE: The position() function doesn't check for failsafe.
)platformModule	_positionrh  rQ  )r   r   posxposys       r   rn  rn    sM      ))+JDt9Dt9D}1v}1vr   c                  8    [        [        R                  " 5       6 $ )zReturns the width and height of the screen as a two-integer tuple.

Returns:
  (width, height) tuple of the screen size, in pixels.
)rR  r  _sizer
   r   r   sizer  	  s     %%'((r   c                     [        X5      u  p[        U 5      n [        U5      n[        R                  " 5       u  p#SU s=:*  =(       a    U:  Os  =(       a    SUs=:*  =(       a    U:  $ s  $ )a  Returns whether the given xy coordinates are on the primary screen or not.

Note that this function doesn't work for secondary screens.

Args:
  Either the arguments are two separate values, first arg for x and second
    for y, or there is a single argument of a sequence with two values, the
    first x and the second y.
    Example: onScreen(x, y) or onScreen([x, y])

Returns:
  bool: True if the xy coordinates are on the screen at its current
    resolution, otherwise False.
r   )rv  rh  r  r  )r   r   widthheights       r   onScreenr    sV     A!DAAAAA"((*ME>>E>-a1oovo-o-r   c                 f   U R                  5       n [        R                  " 5       S:X  a2  U [        [        [
        [        [        SSSSSSS4;  a  [        S	5      eO-U [        [        [
        [        [        SSS4;  a  [        S
5      eU [        [        4;   a]  [        R                  " 5       nU(       a!  U [        :X  a  [
        $ U [        :X  a  [        $ O U [        :X  a  [        $ U [        :X  a  [
        $ [        [        [        [        [
        [
        S[        S[        S[
        SSSSSSSS0
U    $ )a  
The left, middle, and right mouse buttons are button numbers 1, 2, and 3 respectively. This is the numbering that
Xlib on Linux uses (while Windows and macOS don't care about numbers; they just use "left" and "right").

This function takes one of ``LEFT``, ``MIDDLE``, ``RIGHT``, ``PRIMARY``, ``SECONDARY``, ``1``, ``2``, ``3``, ``4``,
``5``, ``6``, or ``7`` for the button argument and returns either ``LEFT``, ``MIDDLE``, ``RIGHT``, ``4``, ``5``,
``6``, or ``7``. The ``PRIMARY``, ``SECONDARY``, ``1``, ``2``, and ``3`` values are never returned.

The ``'left'`` and ``'right'`` mouse buttons will always refer to the physical left and right
buttons on the mouse. The same applies for buttons 1 and 3.

However, if ``button`` is ``'primary'`` or ``'secondary'``, then we must check if
the mouse buttons have been "swapped" (for left-handed users) by the operating system's mouse
settings.

If the buttons are swapped, the primary button is the right mouse button and the secondary button is the left mouse
button. If not swapped, the primary and secondary buttons are the left and right buttons, respectively.

NOTE: Swap detection has not been implemented yet.
rN  r   r   r   rm           zgbutton argument must be one of ('left', 'middle', 'right', 'primary', 'secondary', 1, 2, 3, 4, 5, 6, 7)z[button argument must be one of ('left', 'middle', 'right', 'primary', 'secondary', 1, 2, 3))lowerplatformsystemLEFTMIDDLERIGHTPRIMARY	SECONDARYr   r  _mouse_is_swapped)buttonswappeds     r   _normalizeButtonr  9  s   2 \\^FG#$w	1aAqRSUVWW$y  X $w	1aKK$m 
 '9%% 224 9$ %  9$ $uaq&!UTUWXZ[]^`acdfgijklrssr   rc  c           
          [        U5      n[        X5      u  p[        SXSSSSS9  [        USU < SU< 3SS9  [        R
                  " XU5        g)	aa  Performs pressing a mouse button down (but not up).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    mouse down happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    mouse down happens. None by default.
  button (str, int, optional): The mouse button pressed down. TODO

Returns:
  None

Raises:
  PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, or 3
mover   Ndurationtween	mouseDownr   r   r  )r  rv  _mouseMoveDragr  r  
_mouseDownr   r   r  r  r  r  rU  s          r   r  r  r  sO    0 f%FA!DA61A>=+!Q/?LaF+r   c           
          [        U5      n[        X5      u  p[        SXSSSSS9  [        USU < SU< 3SS9  [        R
                  " XU5        g)	ae  Performs releasing a mouse button up (but not down beforehand).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    mouse up happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    mouse up happens. None by default.
  button (str, int, optional): The mouse button released. TODO

Returns:
  None

Raises:
  PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, or 3
r  r   Nr  mouseUpr   r   r  )r  rv  r  r  r  _mouseUpr  s          r   r  r    sO    0 f%FA!DA61A>=)1-=cJA&)r   c	                    [        U5      n[        X5      u  p[        SXSSXV5        [        USU< SU< SU < SU< 3SS9  [        R
                  S:X  aM  [        U5       H=  n	[        5         U[        [        [        4;   d  M$  [        R                  " XUSU5        M?     g	[        U5       HO  n	[        5         U[        [        [        4;   a  [        R                  " XU5        [        R                  " U5        MQ     g	)
a  
Performs pressing a mouse button down and then immediately releasing it. Returns ``None``.

When no arguments are passed, the primary mouse button is clicked at the mouse cursor's current location.

If integers for ``x`` and ``y`` are passed, the click will happen at that XY coordinate. If ``x`` is a string, the
string is an image filename that PyAutoGUI will attempt to locate on the screen and click the center of. If ``x``
is a sequence of two coordinates, those coordinates will be used for the XY coordinate to click on.

The ``clicks`` argument is an int of how many clicks to make, and defaults to ``1``.

The ``interval`` argument is an int or float of how many seconds to wait in between each click, if ``clicks`` is
greater than ``1``. It defaults to ``0.0`` for no pause in between clicks.

The ``button`` argument is one of the constants ``LEFT``, ``MIDDLE``, ``RIGHT``, ``PRIMARY``, or ``SECONDARY``.
It defaults to ``PRIMARY`` (which is the left mouse button, unless the operating system has been set for
left-handed users.)

If ``x`` and ``y`` are specified, and the click is not happening at the mouse cursor's current location, then
the ``duration`` argument is an int or float of how many seconds it should take to move the mouse to the XY
coordinates. It defaults to ``0`` for an instant move.

If ``x`` and ``y`` are specified and ``duration`` is not ``0``, the ``tween`` argument is a tweening function
that specifies the movement pattern of the mouse cursor as it moves to the XY coordinates. The default is a
simple linear tween. See the PyTweening module documentation for more details.

The ``pause`` parameter is deprecated. Call the ``pyautogui.sleep()`` function to implement a pause.

Raises:
  PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, 3
r  r   clickr   r   r  rK  r   N)r  rv  r  r  sysr  rangerV  r  r  r  r  _multiClick_clickrj  r1  )
r   r   clicksintervalr  r  r  r  rU  r   s
             r   r  r    s    H f%FA!DA 61Ax7='FFAq+QZ]^
||xvAO$..**1HE 
 vAO$..%%aF3JJx  r   c                 (    [        XSU[        X4XVS9	  g)a  Performs a left mouse button click.

This is a wrapper function for click('left', x, y).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.
  interval (float, optional): The number of seconds in between each click,
    if the number of clicks is greater than 1. 0.0 by default, for no
    pause in between clicks.

Returns:
  None
r   rk  N)r  r  r   r   r  r  r  r  rU  s          r   	leftClickr    s    6 
!8T8MQr   c                 (    [        XSU[        X4XVS9	  g)a  Performs a right mouse button click.

This is a wrapper function for click('right', x, y).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.
  interval (float, optional): The number of seconds in between each click,
    if the number of clicks is greater than 1. 0.0 by default, for no
    pause in between clicks.

Returns:
  None
r   rk  N)r  r  r  s          r   
rightClickr    s    2 
!8UH]Rr   c                 (    [        XSU[        X4XVS9	  g)a  Performs a middle mouse button click.

This is a wrapper function for click('middle', x, y).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.

Returns:
  None
r   rk  N)r  r  r  s          r   middleClickr  (  s    , 
!8VXmSr   c                    [         R                  S:X  ac  [        X5      u  p[        SXSSSSS9  [        R
                  " 5       u  p[        R                  " XUS5        [        USU < SU< SU< S	3S
S9  g[        XSX#XEUSS9	  g)a8  Performs a double click.

This is a wrapper function for click('left', x, y, 2, interval).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.
  interval (float, optional): The number of seconds in between each click,
    if the number of clicks is greater than 1. 0.0 by default, for no
    pause in between clicks.
  button (str, int, optional): The mouse button released. TODO

Returns:
  None

Raises:
  PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, 3, 4,
    5, 6, or 7
rK  r  r   Nr  r   r  r   z,2r   r  Frk  )	r  r  rv  r  r  r  r  r  r  r   r   r  r  r  r  r  rU  s           r   doubleClickr  A  s|    @ ||x%vqQATB'')""13}gq!V/LUXY 	aAx-PUVr   c                    [         R                  S:X  ac  [        X5      u  p[        SXSSSSS9  [        R
                  " 5       u  p[        USU < SU< SU< S3S	S
9  [        R                  " XUS5        g[        XSX#XEUSS9	  g)a8  Performs a triple click.

This is a wrapper function for click('left', x, y, 3, interval).

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.
  interval (float, optional): The number of seconds in between each click,
    if the number of clicks is greater than 1. 0.0 by default, for no
    pause in between clicks.
  button (str, int, optional): The mouse button released. TODO

Returns:
  None

Raises:
  PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, 3, 4,
    5, 6, or 7
rK  r  r   Nr  r  r   z,3r   r  r   Frk  )	r  r  rv  r  r  r  r  r  r  r  s           r   tripleClickr  l  s{    > ||x%vqQATB'')}gq!V/LUXY""13 	aAx-PUVr   c           	          [        U5      [        [        4;   a	  US   US   p![        X5      u  p[	        USU < SU< SU< 3SS9  [
        R                  " XU5        g)a  Performs a scroll of the mouse scroll wheel.

Whether this is a vertical or horizontal scroll depends on the underlying
operating system.

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  clicks (int, float): The amount of scrolling to perform.
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.

Returns:
  None
r   r   scrollr   r   r  N)typetuplelistrn  r  r  _scrollr  r   r   r  rU  s        r   r  r    sT    , Aw5$-tQqT1A>DA=(&!Q,GPST6a(r   c           	          [        U5      [        [        4;   a	  US   US   p![        X5      u  p[	        USU < SU< SU< 3SS9  [
        R                  " XU5        g)a  Performs an explicitly horizontal scroll of the mouse scroll wheel,
if this is supported by the operating system. (Currently just Linux.)

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  clicks (int, float): The amount of scrolling to perform.
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.

Returns:
  None
r   r   hscrollr   r   r  N)r  r  r  rn  r  r  _hscrollr  s        r   r  r    T    ( Aw5$-tQqT1A>DA=)61a-HQTUFq)r   c           	          [        U5      [        [        4;   a	  US   US   p![        X5      u  p[	        USU < SU< SU< 3SS9  [
        R                  " XU5        g)a  Performs an explicitly vertical scroll of the mouse scroll wheel,
if this is supported by the operating system. (Currently just Linux.)

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  clicks (int, float): The amount of scrolling to perform.
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.

Returns:
  None
r   r   vscrollr   r   r  N)r  r  r  rn  r  r  _vscrollr  s        r   r  r    r  r   c           	      b    [        X5      u  p[        USU < SU< 3SS9  [        SXSSX#5        g)a  Moves the mouse cursor to a point on the screen.

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): The x position on the screen where the
    click happens. None by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): The y position on the screen where the
    click happens. None by default.
  duration (float, optional): The amount of time it takes to move the mouse
    cursor to the xy coordinates. If 0, then the mouse cursor is moved
    instantaneously. 0.0 by default.
  tween (func, optional): The tweening function used if the duration is not
    0. A linear tween is used by default.

Returns:
  None
moveTor   r   r  r  r   Nrv  r  r  )r   r   r  r  r  rU  s         r   r  r    s3    2 A!DA=(q!,<SI61Ax7r   c           	      b    [        X5      u  p[        USU < SU< 3SS9  [        SSSXX#5        g)a  Moves the mouse cursor to a point on the screen, relative to its current
position.

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): How far left (for negative values) or
    right (for positive values) to move the cursor. 0 by default. If tuple, this is used for x and y.
  y (int, float, None, optional): How far up (for negative values) or
    down (for positive values) to move the cursor. 0 by default.
  duration (float, optional): The amount of time it takes to move the mouse
    cursor to the new xy coordinates. If 0, then the mouse cursor is moved
    instantaneously. 0.0 by default.
  tween (func, optional): The tweening function used if the duration is not
    0. A linear tween is used by default.

Returns:
  None
moveRelr   r   r  r  Nr  )xOffsetyOffsetr  r  r  rU  s         r   r  r    s5    0 (9G=)-IRUV64wIr   c           
          [        X5      u  p[        USU < SU< 3SS9  U(       a  [        USSS9  [        SXSSX#U5        U(       a  [	        USSS9  g	g	)
a(  Performs a mouse drag (mouse movement while a button is held down) to a
point on the screen.

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): How far left (for negative values) or
    right (for positive values) to move the cursor. 0 by default. If tuple, this is used for x and y.
    If x is a str, it's considered a filename of an image to find on
    the screen with locateOnScreen() and click the center of.
  y (int, float, None, optional): How far up (for negative values) or
    down (for positive values) to move the cursor. 0 by default.
  duration (float, optional): The amount of time it takes to move the mouse
    cursor to the new xy coordinates. If 0, then the mouse cursor is moved
    instantaneously. 0.0 by default.
  tween (func, optional): The tweening function used if the duration is not
    0. A linear tween is used by default.
  button (str, int, optional): The mouse button released. TODO
  mouseDownUp (True, False): When true, the mouseUp/Down actions are not performed.
    Which allows dragging over multiple (small) actions. 'True' by default.

Returns:
  None
dragTor   r   r  Fr  r  rU  dragr   N)rv  r  r  r  r  )r   r   r  r  r  r  rU  mouseDownUps           r   r  r  ,  sX    > A!DA=(q!,<SIuUC61Ax?vU5A r   c           
      2   U c  Sn Uc  Sn[        U 5      [        [        4;   a	  U S   U S   pU S:X  a  US:X  a  g[        R                  " 5       u  p[        USU < SU< 3SS9  U(       a  [        USSS	9  [        S
XXX#U5        U(       a  [        USSS	9  gg)a  Performs a mouse drag (mouse movement while a button is held down) to a
point on the screen, relative to its current position.

The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.

Args:
  x (int, float, None, tuple, optional): How far left (for negative values) or
    right (for positive values) to move the cursor. 0 by default. If tuple, this is used for xOffset and yOffset.
  y (int, float, None, optional): How far up (for negative values) or
    down (for positive values) to move the cursor. 0 by default.
  duration (float, optional): The amount of time it takes to move the mouse
    cursor to the new xy coordinates. If 0, then the mouse cursor is moved
    instantaneously. 0.0 by default.
  tween (func, optional): The tweening function used if the duration is not
    0. A linear tween is used by default.
  button (str, int, optional): The mouse button released. TODO
  mouseDownUp (True, False): When true, the mouseUp/Down actions are not performed.
    Which allows dragging over multiple (small) actions. 'True' by default.

Returns:
  None
Nr   r   dragRelr   r   r  Fr  r  )	r  r  r  r  r  r  r  r  r  )
r  r  r  r  r  r  rU  r  mousexmouseys
             r   r  r  U  s    : G}%"1:wqz!|1#--/NF=)-IRUVuUC667XfUvU5A r   c                    U S;   d
   SU -  5       e[         R                  S:w  a  Sn Ub  [        U5      OSnUb  [        U5      OSnUc  Uc  US:X  a  US:X  a  g[        5       u  pUb  [        U5      OUnUb  [        U5      OU	nX-  nX$-  n[	        5       u  pX4/nU[
        :  ao  [        X5      nX]-  nU[        :  a  [        U[        -  5      nX]-  n[        U5       Vs/ s H  n[        XXU" X-  5      5      PM     nnUR                  X45        U H  u  nn[        U5      S:  a  [        R                  " W5        [        [        U5      5      n[        [        U5      5      nUU4[        ;  a
  [!        5         U S:X  a  ["        R$                  " UU5        M  U S:X  a  ["        R&                  " UUU5        M  [)        S	R+                  U 5      5      e   WW4[        ;  a  [!        5         ggs  snf )
a  Handles the actual move or drag event, since different platforms
implement them differently.

On Windows & Linux, a drag is a normal mouse move while a mouse button is
held down. On OS X, a distinct "drag" event must be used instead.

The code for moving and dragging the mouse is similar, so this function
handles both. Users should call the moveTo() or dragTo() functions instead
of calling _mouseMoveDrag().

Args:
  moveOrDrag (str): Either 'move' or 'drag', for the type of action this is.
  x (int, float, None, optional): How far left (for negative values) or
    right (for positive values) to move the cursor. 0 by default.
  y (int, float, None, optional): How far up (for negative values) or
    down (for positive values) to move the cursor. 0 by default.
  xOffset (int, float, None, optional): How far left (for negative values) or
    right (for positive values) to move the cursor. 0 by default.
  yOffset (int, float, None, optional): How far up (for negative values) or
    down (for positive values) to move the cursor. 0 by default.
  duration (float, optional): The amount of time it takes to move the mouse
    cursor to the new xy coordinates. If 0, then the mouse cursor is moved
    instantaneously. 0.0 by default.
  tween (func, optional): The tweening function used if the duration is not
    0. A linear tween is used by default.
  button (str, int, optional): The mouse button released. TODO

Returns:
  None
)r  r  z.moveOrDrag must be in ('move', 'drag'), not %srK  r  Nr   r   r  z Unknown value of moveOrDrag: {0})r  r  rh  rn  r  MINIMUM_DURATIONmaxMINIMUM_SLEEPr  ra  r  rp  rj  r1  roundFAILSAFE_POINTSrV  r  _moveTo_dragToNotImplementedErrorrq  )
moveOrDragr   r   r  r  r  r  r  startxstartyr  r  steps	num_stepssleep_amountr   tweenXtweenYs                     r   r  r    s   D ))j+[_i+jj)
||x
%1c'lqG%1c'lqGyQY7a<GqLZNF-AVA-AVA LALAFME VHE""&	+-'H}45I#/LUZ[dUefUePQeAM6JKUefaVu:>JJ|$U6]#U6]#
 F?2O""6626!""666:%&H&O&OPZ&[\\'  * 	. /3 gs   $G5c                 F    [         R                  R                  U S5      SL$ )a'  Returns a Boolean value if the given key is a valid value to pass to
PyAutoGUI's keyboard-related functions for the current platform.

This function is here because passing an invalid value to the PyAutoGUI
keyboard functions currently is a no-op that does not raise an exception.

Some keys are only valid on some platforms. For example, while 'esc' is
valid for the Escape key on all platforms, 'browserback' is only used on
Windows operating systems.

Args:
  key (str): The key value.

Returns:
  bool: True if key is a valid value, False if not.
N)r  keyboardMappingrX  )keys    r   
isValidKeyr    s"    " ))--c48DDr   c                     [        U 5      S:  a  U R                  5       n [        USU SS9  [        R                  " U 5        g)aS  Performs a keyboard key press without the release. This will put that
key in a held down state.

NOTE: For some reason, this does not seem to cause key repeats like would
happen if a keyboard key was held down on a text field.

Args:
  key (str): The key to be pressed down. The valid names are listed in
  KEYBOARD_KEYS.

Returns:
  None
r   keyDownr   r  N)rp  r  r  r  _keyDownr  r  rU  s      r   r  r    s6     3x!|iik=)S=C r   c                     [        U 5      S:  a  U R                  5       n [        USU SS9  [        R                  " U 5        g)zPerforms a keyboard key release (without the press down beforehand).

Args:
  key (str): The key to be released up. The valid names are listed in
  KEYBOARD_KEYS.

Returns:
  None
r   keyUpr   r  N)rp  r  r  r  _keyUpr  s      r   r  r    s6     3x!|iik='3s;#r   c                 &   [        U 5      [        :X  a#  [        U 5      S:  a  U R                  5       n U /n ON/ nU  HD  n[        U5      S:  a!  UR	                  UR                  5       5        M3  UR	                  U5        MF     Un [        U5      n[        USSR                  U 5      SS9  [        U5       HX  nU  H9  n[        5         [        R                  " U5        [        R                  " U5        M;     [        R                  " U5        MZ     g)a2  Performs a keyboard key press down, followed by a release.

Args:
  key (str, list): The key to be pressed. The valid names are listed in
  KEYBOARD_KEYS. Can also be a list of such strings.
  presses (integer, optional): The number of press repetitions.
  1 by default, for just one press.
  interval (float, optional): How many seconds between each press.
  0.0 by default, for no pause between presses.
  pause (float, optional): How many seconds in the end of function process.
  None by default, for no pause in the end of function process.
Returns:
  None
r   pressr   r   r  N)r  ro  rp  r  r  ri  r  r  r  rV  r  r  r	  rj  r1  )	keyspressesr  r  rU  	lowerKeysr   r   r   s	            r   r  r  -  s      DzSt9q=::<Dv	A1vz  +  #	 
 XH='388D>#F7^AO##A&!!!$  	

8 r   c              #   T  #    [        U 5      [        :X  a#  [        U 5      S:  a  U R                  5       n U /n ON/ nU  HD  n[        U5      S:  a!  UR	                  UR                  5       5        M3  UR	                  U5        MF     Un [        USSR                  U 5      SS9  U  H#  n[        5         [        R                  " U5        M%      Sv   U  H#  n[        5         [        R                  " U5        M%     g! U  H#  n[        5         [        R                  " U5        M%     f = f7f)a  Context manager that performs a keyboard key press down upon entry,
followed by a release upon exit.

Args:
  key (str, list): The key to be pressed. The valid names are listed in
  KEYBOARD_KEYS. Can also be a list of such strings.
  pause (float, optional): How many seconds in the end of function process.
  None by default, for no pause in the end of function process.
Returns:
  None
r   r  r   r   r  N)r  ro  rp  r  r  r  r  rV  r  r  r	  )r  r  rU  r  r   r   s         r   holdr  S  s      DzSt9q=::<Dv	A1vz  +  #	 
 ='388D>#F" %AO!!!$ AO!!!$ s   C	D(C: *D(:+D%%D(c                     [        U5      n[        USU SS9  U  HL  n[        U5      S:  a  UR                  5       n[	        USS9  [
        R                  " U5        [        5         MN     g)a  Performs a keyboard key press down, followed by a release, for each of
the characters in message.

The message argument can also be list of strings, in which case any valid
keyboard name can be used.

Since this performs a sequence of keyboard presses and does not hold down
keys, it cannot be used to perform keyboard shortcuts. Use the hotkey()
function for that.

Args:
  message (str, list): If a string, then the characters to be pressed. If a
    list, then the key names of the keys to press in order. The valid names
    are listed in KEYBOARD_KEYS.
  interval (float, optional): The number of seconds in between each press.
    0.0 by default, for no pause in between presses.

Returns:
  None
writer   r  r   Frk  N)ri  r  rp  r  r  rj  r1  rV  )messager  r  rU  r   s        r   	typewriter  y  sV    , XH='73?q6A:	Aa

8 r   c                     [        UR                  SS5      5      n[        U 5      (       a>  [        U S   [        5      (       a&  [        U S   [
        5      (       d  [        U S   5      n [        UR                  S5      SSR                  U 5      SS9  U  HN  n[        U5      S	:  a  UR                  5       n[        R                  " U5        [        R                  " U5        MP     [        U 5       HN  n[        U5      S	:  a  UR                  5       n[        R                  " U5        [        R                  " U5        MP     g
)a  Performs key down presses on the arguments passed in order, then performs
key releases in reverse order.

The effect is that calling hotkey('ctrl', 'shift', 'c') would perform a
"Ctrl-Shift-C" hotkey/keyboard shortcut press.

Args:
  key(s) (str): The series of keys to press, in order. This can also be a
    list of key strings to press.
  interval (float, optional): The number of seconds in between each press.
    0.0 by default, for no pause in between presses.

Returns:
  None
r  rc  r   r  hotkeyr   r   r  r   N)ri  rX  rp  rf  r   ro  r  r  r  r  r  r  rj  r1  reversedr	  )rM   rN   r  r   s       r   r  r    s    " VZZ
C01H
4yyZQ22:d1gs;S;ST!W~6::o.#((4.QTUq6A:	A"

8	 
 d^q6A:	Aa 

8	 r   c                  h    [         (       a'  [        [        5       5      [        ;   a  [	        S5      eg g )NzPyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED.)FAILSAFEr  rn  r  r   r
   r   r   rV  rV    s/    xE(*%8 }
 	
 9xr   c                     [         R                  R                  R                  S5      n[        S5        U S:w  d  US:w  a  [        SU < SU< 35          [        5       u  p4S[        X0-
  5      R                  S5      -   S	-   [        XA-
  5      R                  S5      -   n[        X0-
  XA-
  5      (       a  [         R                  S
:X  a  SnO%[        R                  " 5       R                  X445      nUS[        US   5      R                  S5      -   -  nUS[        US   5      R                  S5      -   -  nUS[        US   5      R                  S5      -   S-   -  n[         R                  R                  U5        U(       d,  [         R                  R                  S[!        U5      -  5        O5[         R                  R                  S5        ["        R$                  " S5        [         R                  R'                  5         GM  ! [         a    Sn GNf = f! [(         a@    [         R                  R                  S5        [         R                  R'                  5          gf = f)zThis function is meant to be run from the command line. It will
automatically display the location and RGB of the mouse cursor.idlelibFzPress Ctrl-C to quit.r   z	xOffset: z
 yOffset: zX: rm  z Y: rK  )NaNr  r  z RGB: (r   z, r   r   r   r   N)r  stdinr   
startswithAttributeErrorr$  rn  ro  r  r  r  rL   rZ   getpixelstdoutr  rp  rj  r1  flushKeyboardInterrupt)r  r  runningIDLEr   r   positionStr
pixelColors          r   displayMousePositionr(    s   ii**55i@ 

!"!|w!|7G<=:DA#ak"2"8"8";;fDs1;GWG]G]^_G``KAK559Q2
&113<<F
 9s:a='9'?'?'BBBK4#jm"4":":1"===K4#jm"4":":1"==CCKJJ[)

  K(8!89 

  &

1JJ-   <  



s%   )H F1H HHAI$#I$c                 f   Ub  Ub  [        S5      eUb  [        R                  " 5       u  pEUc  [        R                  " 5       n[
        R
                  R                  5       nUR                  < S[        UR                  5      R                  SS5      < S[        UR                  5      R                  SS5      < SUR                  < SUR                  < SUR                  < S[        UR                  5      S S < SU < S3n[        R                   R#                  X5      n[%        U5        g )NzVEither region or radius arguments (or neither) can be passed to snapshot, but not bothr   r   r   r   r   ry  )	Exceptionr  r  r  getcwdr{  r|  r}  ro  r~  r  r  r  r  r  r  r  r  rZ   )	tagr  regionradiusr   r   r|  r  r  s	            r   	_snapshotr/    s    f0pqq'')~





!CCIIQ$CGG1c"



COORa 	H ww||F-Hxr   c                 0    [         R                  " U 5        g rK   )rj  r1  )secondss    r   r1  r1    s    JJwr   c                     [        U SS5       H-  n[        [        U5      SSS9  [        R                  " S5        M/     [        5         g )Nr   r   T)r   r#  r   )r  r$  ro  rj  r1  )r1  r   s     r   	countdownr4    s7    7Ar"c!f#T*

1 # 
Gr   c                     [         R                  " S5      nUR                  U 5      nUc  [        S5      eUR	                  S5      $ )a   Gets the number token at the start of commandStr.

Given '5hello' returns '5'
Given '  5hello' returns '  5'
Given '-42hello' returns '-42'
Given '+42hello' returns '+42'
Given '3.14hello' returns '3.14'

Raises an exception if it can't tokenize a number.
z^(\s*(\+|\-)?\d+(\.\d+)?)z1Invalid command at index 0: a number was expectedr   recompilesearchr   group
commandStrpatternmos      r   _getNumberTokenr?    s@     jj56G	
	#B	z !TUU88A;r   c                     [         R                  " S5      nUR                  U 5      nUc  [        S5      eUR	                  S5      $ )zGets the quoted string token at the start of commandStr.
The quoted string must use single quotes.

Given "'hello'world" returns "'hello'"
Given "  'hello'world" returns "  'hello'"

Raises an exception if it can't tokenize a quoted string.
z^((\s*)('(.*?)'))z8Invalid command at index 0: a quoted string was expectedr   r6  r;  s      r   _getQuotedStringTokenrA  +  s@     jj-.G	
	#B	z ![\\88A;r   c                 Z   [         R                  " S5      nUR                  U 5      nUc  [        S5      eSnSnU[	        U 5      :  aN  X   S:X  a  US-  nO*X   S:X  a"  US-  nUS:X  a  US-  nO'US:X  a  [        S5      eUS-  nU[	        U 5      :  a  MN  US:  a  [        S	5      eU SU $ )
a  Gets the command string token at the start of commandStr. It will also
be enclosed with parentheses.

Given "(ccc)world" returns "(ccc)"
Given "  (ccc)world" returns "  (ccc)"
Given "(ccf10(r))world" returns "(ccf10(r))"

Raises an exception if it can't tokenize a quoted string.
z^\s*\(z6Invalid command at index 0: No open parenthesis found.r   r   r   r   r3  zKInvalid command at index 0: No open parenthesis for this close parenthesis.z9Invalid command at index 0: Not enough close parentheses.)r7  r8  r9  r   rp  )r<  r=  r>  r   openParensCounts        r   _getParensCommandStrTokenrD  <  s     jj#G	
	#B	z !YZZ 	
AO
c*o
=Cq O]c!q O!#Q B&()vww	Q c*o
  !\]]a?r   c                     [         R                  " S5      nUR                  U 5      nUc  [        S5      eUR	                  S5      $ )zGets the comma token at the start of commandStr.

Given ',' returns ','
Given '  ,', returns '  ,'

Raises an exception if a comma isn't found.
z	^((\s*),)z0Invalid command at index 0: a comma was expectedr   r6  r;  s      r   _getCommaTokenrF  a  s?     jj&G	
	#B	z !STT88A;r   c                 >	   [         R                  " S5      n/ nSnU[        U 5      :  Ga  X   S;   a  US-  nM  UR                  XS 5      nUc  [	        SU< SX   < S35      eUR                  S5      nUR                  U5        U[        U5      -  nUS	;   a  GOuUS
;   Ga^   [        XS 5      nU[        U5      -  n[        XS 5      nU[        U5      -  n[        XS 5      nU[        U5      -  nUR                  5       S   R                  5       (       a@  UR                  5       S   R                  5       (       d  [	        SU[        U5      -
  -  5      eUR                  5       S   R                  5       (       d@  UR                  5       S   R                  5       (       a  [	        SU[        U5      -
  -  5      eUR                  UR                  5       5        UR                  UR                  5       5        GOUS;   a<   [        XS 5      nU[        U5      -  nUR                  UR                  5       5        OUS;   a?   [        XS 5      nU[        U5      -  nUR                  USS R                  5       5        OUS:X  a   [        XS 5      nU[        U5      -  n[        XS 5      nU[        U5      -  nUR                  UR                  5       5        UR                  5       SS nUR                  [!        U5      5        U[        U 5      :  a  GM  U$ ! [         aQ  n	[        U	5      R                  S5      u  pnU
[        S5      S n[        U5      U-   n[	        SU< SU< 35      eSn	A	ff = f! [         aQ  n	[        U	5      R                  S5      u  pnU
[        S5      S n[        U5      U-   n[	        SU< SU< 35      eSn	A	ff = f! [         aQ  n	[        U	5      R                  S5      u  pnU
[        S5      S n[        U5      U-   n[	        SU< SU< 35      eSn	A	ff = f! [         aQ  n	[        U	5      R                  S5      u  pnU
[        S5      S n[        U5      U-   n[	        SU< SU< 35      eSn	A	ff = f)zjTokenizes commandStr into a list of commands and their arguments for
the run() function. Returns the list.z%^(su|sd|ss|c|l|m|r|g|d|k|w|h|f|s|a|p)r   )r   r   r   r   r   NzInvalid command at index z: z is not a valid command)r   r   r   r   susdss)r   r   r   z8Invalid command at index %s: Y has a +/- but X does not.z>Invalid command at index %s: Y does not have a +/- but X does.)r   r   )r   r   r   r   r3  r   )r7  r8  rp  matchr   r:  r  r?  rF  ro  	partitionrh  lstrip	isdecimalrA  rD  _tokenizeCommandStr)r<  commandPatterncommandListr   r>  individualCommandr   commar   excObj	indexPartcolonr  indexNumnewIndexNumnumquotedStringnumberOfLoopssubCommandStrs                      r   rO  rO  q  s    ZZ HIN K	A
c*o
=33FA!!*R.1:$abdndq%rssHHQK,-	S"##  FF *,d#JrN3SV&z"~6SZ#JrN3SV xxz!}&&((A1H1H1J1J()cghknopkqgq)rss88:a=**,,A1H1H1J1J(TXY\_`a\bXbc 
 qxxz*qxxz* *,d%jn5SX szz|, "66
d4Z^DS&& |Ab188:; #%d /
2 ?S'' 9*R. IS'' }3356 *0021R8M2=ABa c*o
d i & d -0K,A,A#,F)	'$S)D%E%GH!(ma/([Za)bccd: & d -0K,A,A#,F)	'$S)D%E%GH!(ma/([Za)bccd" & d -0K,A,A#,F)	'$S)D%E%GH!(ma/([Za)bccd* & d -0K,A,A#,F)	'$S)D%E%GH!(ma/([Za)bccdse   &AL' 
N O# 6Q '
N1AM==N
O AOO #
P>-AP99P>
RARRc                    SnU[        U 5      :  Ga  X   nUS:X  a  [        [        S9  GOUS:X  a  [        [        S9  GOtUS:X  a  [        [        S9  GO_US:X  a  [        [
        S9  GOJUS:X  a  [        S5        GO7US	:X  a  [        S
5        GO$US:X  a   [        SUS   -  5        US==   S-  ss'   GOUS:X  a   [        [        XS-      5      5        US-  nGOUS:X  a  [        XS-      5      q
US-  nGOUS:X  at  XS-      S   S;   a7  XS-      S   S;   a)  [        [        XS-      5      [        XS-      5      5        O([        [        XS-      5      [        XS-      5      5        US-  nGOAUS:X  as  XS-      S   S;   a7  XS-      S   S;   a)  [        [        XS-      5      [        XS-      5      5        O([        [        XS-      5      [        XS-      5      5        US-  nOUS:X  a  [!        XS-      5        US-  nOUS:X  a  [#        XS-      5        US-  nOUS:X  a2  [%        XS-      R'                  SS5      R)                  S5      6   US-  nOXUS:X  a  [+        XS-      5        US-  nO<US:X  a6  [-        [        XS-      5      5       H  n[/        XS-      U5        M     US-  nUS-  nU[        U 5      :  a  GM  g g )Nr   r   )r  r   r   r   rH  r   rI  r3  rJ  zscreenshot%s.pngr   r   r   )r   r   r   r   r   r   r   r    r   r   r   )rp  r  r  r  r  r  r  rZ   r1  ri  rg  r  rh  r  r  r  r  r  r  replacesplitrC   r  _runCommandList)rQ  _ssCountr   r>  r   s        r   ra  ra    s   	A
c+
.c>!^^ ^_1I_2J_)Xa[9:QK1K^%E*+,FA^+!e,-EFA^q5!!$
2{q57I!7LPZ7ZSU+,c+!e2D.EFs;1u-.KA4F0GHFA^q5!!$
2{q57I!7LPZ7ZSU+,c+!e2D.EFs;1u-.KA4F0GHFA^+!e$%FA^+!e$%FA^KA&..sB7==cBCFA^+!e$%FA^3{q5123E 2H= 4FA	Qi c+

r   c                 L    Uc  S/n[        U 5      n[        n[        X!5        Uqg)a!  Run a series of PyAutoGUI function calls according to a mini-language
made for this function. The `commandStr` is composed of character
commands that represent PyAutoGUI function calls.

For example, `run('ccg-20,+0c')` clicks the mouse twice, then makes
the mouse cursor go 20 pixels to the left, then click again.

Whitespace between commands and arguments is ignored. Command characters
must be lowercase. Quotes must be single quotes.

For example, the previous call could also be written as `run('c c g -20, +0 c')`.

The character commands and their equivalents are here:

`c` => `click(button=PRIMARY)`
`l` => `click(button=LEFT)`
`m` => `click(button=MIDDLE)`
`r` => `click(button=RIGHT)`
`su` => `scroll(1) # scroll up`
`sd` => `scroll(-1) # scroll down`
`ss` => `screenshot('screenshot1.png') # filename number increases on its own`

`gX,Y` => `moveTo(X, Y)`
`g+X,-Y` => `move(X, Y) # The + or - prefix is the difference between move() and moveTo()`
`dX,Y` => `dragTo(X, Y)`
`d+X,-Y` => `drag(X, Y) # The + or - prefix is the difference between drag() and dragTo()`

`k'key'` => `press('key')`
`w'text'` => `write('text')`
`h'key,key,key'` => `hotkey(*'key,key,key'.replace(' ', '').split(','))`
`a'hello'` => `alert('hello')`

`sN` => `sleep(N) # N can be an int or float`
`pN` => `PAUSE = N # N can be an int or float`

`fN(commands)` => for i in range(N): run(commands)

Note that any changes to `PAUSE` with the `p` command will be undone when
this function returns. The original `PAUSE` setting will be reset.

TODO - This function is under development.
Nr   )rO  rg  ra  )r<  rb  rQ  originalPAUSEs       r   runre  )  s5    ` 
 &j1K MK*Er   c                 X    SR                   " [        5       6 nU (       d  [        U5        U$ )Nz
         Platform: {}
   Python Version: {}
PyAutoGUI Version: {}
       Executable: {}
       Resolution: {}
        Timestamp: {})rq  getInfor$  )	dontPrintmsgs     r   	printInforj  f  s2        
C c
Jr   c                      [         R                  [         R                  [        [         R                  [        5       [        R                  R                  5       4$ rK   )r  r  version__version__
executabler  r{  r|  r
   r   r   rg  rg  u  s2    LL#++{CNNDFHL]L]LaLaLcddr   rK   )r   )NN)NNNT)NT)r   rc  NT)rc  NT)NNN)F)
__future__r   r   r   rm  collectionsr  rj  r{  r  r  r7  rS   
contextlibr   r*  r   r   r   version_infor   collections.abc
pytweeningr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   ImportErrorrB   pymsgboxrC   rD   rE   rF   rH   rV   rL   rW   rX   rY   rZ   r\   r   r_   ra   rc   re   rh   rk   rm   ro   ru   pygetwindowrw   rx   ry   rz   r{   r|   r}   r   	KEY_NAMESKEYBOARD_KEYSr  r  r  r  r  QWERTYQWERTZrI  r  r  r^  rL  r  rM  r  rO  r  r  rg  DARWIN_CATCH_UP_TIMEr  r  rz  r  r  
namedtuplerQ  rR  r[  ra  rd  rW  rv  r  rn  r  
resolutionr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  shortcutrV  r(  r/  r1  r4  r?  rA  rD  rF  rO  ra  re  rj  rg  _right_bottomextendr
   r   r   <module>r     s-   A @   
   	  	  %	 		* 	/  A!s//!48HH$ )M0       ^B99"?*FF *1 *1 %%--FN)4 *4 "++33I)< *< !* ; ; C C)? *? $-#A#A#I#I )9 *9 '55==N)9 *9 '55==N6
$&i" <<72	
 	
 	
8C	H  	
	
 
o	nL <<6""
I
JJ\\X2\\W2__'!2
QU]UdUdUfg
hh    	
  
 (    w.fn5(	=4@+1\2) 
.46tr Ws&X\ei , ,@ d7SVZcg * *@ 
d1s7SPVfjsw6! 6!r sSVZcg R R: cW[dh S S6 $s&X\ei T T0 $TCveirv 'W 'WT $TCveirv &W &WR ) ): * *6 * *6 TCvUSW 8 8< $FRW`d J J:  
dSwd[_mq%B %BP q3fWTXaesw-B -B`  HNVZ aPE( ! !*  " " "J !%  !%H  @ 	    F 
%P4&""J {|7t:ze
 &   GaK(6A:q/FQJRS;TU Vi@  (0
 +J+K-M+K,L.N+K,L.N+K,L.N*J+K-M*J+K-M*J+K-M-M.N0*J+K-M,L-M/OQ(0Z  B
 +BAEAGAfxBR  *
 &F%F(I03-N-N$E0)J+*D  	

	
P  2	 ,491821#2s]   A R 	S C"S5 <T T) ASSS21S25TT	T&%T&)UU