{ "info": { "author": "Marcos Boggia", "author_email": "marcos_boggia@hotmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Gui automation\n\nSimple python library useful for automating tasks using images. It can run on Windows background applications.\n\nIt uses OpenCV and PyAutoGui. Made with Python 3.7.\n\n#### Simple example: \n\n```python\nimport cv2\nfrom gui_automation import GuiAuto\n\nimage_path = \"win10key.png\"\nga = GuiAuto()\nif ga.detect(cv2.imread(image_path), 0.8):\n ga.click()\n```\n\nIt searches windows 10 key image in the screen with 80% or more similarity. If it is found it gets clicked (it opens windows 10 start menu).\n\n\n##### The core class is GuiAuto:\nWraps detection and controlling of the GUI.\nBy default it will use normal image detection and foreground app automation.\n\n* Parameters\n\n detector: detector instance. Default is TMDetector()\n handler: handler instance. Default is ForegroundHandler()\n\n* Methods\n\n detect(tpl, img=None): \n returns Spot instance if it finds the tpl in the image. Internally, it keeps the last spot found.\n move(coords=None): \n same as detect but it moves the cursor to the center of the found image withing the screen.\n click(coords=None): \n Clicks the left buttons the quantity specified in @param click(default 1) in the center of the found image.\n hold(coords=None): \n Same as click but instead of clicking X times, it holds the click @param time seconds.\n drag(start_coords, end_coords): \n Drags from one point to another using start and end coordinates.\n drag_within(start_x_fraction, start_y_fraction, end_x_fraction, end_y_fraction): \n Drags from one point to another inside the bounding box of the image found.\n\n For move, click, and hold methods if no coords are given it performs the action on the last spot found.\n\n* drag_within method\n\n Drags the mouse from one point to another using the tpl image width and height.\n All params are fractions in the following string format: 'number/number'.\n Eg: ga.drag_within('3/4', '0/1', '7/8', '4/5')\n\n 3/4 of the width and 0/1 of the height for START\n __o___o_ 7/8 of the width for END\n | S | S = start\n | \\\\ | E = end\n | \\\\ | \\\\ = the mouse drag path\n | E o 4/5 of the height for END\n |________|\n\n##### Detector:\nSearches an image inside another image using template match from OpenCV.\nClasses with default parameters:\n\n TMDetector(method=SQDIFF, thresh=False):\n Applies the normal detection.\n\n MultiscaledTMDetector(method=SQDIFF, thresh=False, reduce_sc=0.2, magnify_sc=2.0, cant_sc=40):\n Applies detection multiples times while resizing the image. Parameters specify how image is resized.\n\n* Parameters\n\n method: template method to use. Could be SQDIFF, CCOEFF or CCORR.\n thresh: boolean that specifies if binary threshold filter must be used for detection.\n reduce_sc: how much the image is reduced.\n magnify_sc how much the image is enlarged.\n cant_sc= how many resizing will be applied.\n\n\n##### Handler:\nInteracts with the app or environment to be automated. Performs clicks, drags among others; and also obtains the screen of the app/environment on an image format.\n\n ForegroundHandler():\n Normal handler that takes screenshot and simulates mouse action normally.\n\n BackgroundHandlerWin32(app_name, *args):\n Handler that works in not vieawable/background applications. It requires an application/window name, and it's possible to pass as arguments a names hierarchy of the UI elements of the application.\n Works only for Windows.\n\n\n##### Spot:\n\nWraps all position/coordinates calculations for the found image.\n\n* Methods:\n\n upper_left_position()\n upper_right_position()\n bottom_left_position()\n bottom_right_position()\n center_position()\n custom_position(x_multiplier, x_modifier, y_multiplier, y_modifier)\n \n* custom_position method:\n\n This method helps calculate any coordinate within the image detected.\n Here is some expanation of its parameters:\n x_multiplier: how many parts of the divided width to take.\n x_modifier: in how many parts the width is going to be divided.\n y_multiplier: same as x_multiplier but with height.\n y_modifier: same as x_modifier but with height.\n \n Eg: x, y = custom_position(3, 8, 1, 2)\n 3/8 of the width\n __o_____\n | |\n | |\n | x o 1/2 of the height\n | |\n |________|\n\n\n##### Image loader:\nLittle module to help load images from a directory.\nLoads all images of a folder given in param path, and assign them to a dictionary in this way: name=>image\nname would be the filename without the extension.\nimage would be the numpy array with the image data loaded with OpenCV.\nPath: relative or absolute path where the images are. Must finish with '/'.\nIt returns a dictionary with the names of the images as keys, and the images themselves as values.\nReturns False if any error.\n\n* Eg:\n\n```python\nfrom gui_automation import GuiAuto, load_images\nfrom time import sleep\n\nbuttons = load_images(\"images/buttons/\")\n\nga = GuiAuto()\nwhile not ga.detect(buttons['start'], 0.8).detect():\n ga.click()\nsleep(2)\nif ga.detect(buttons['accept'], 0.8):\n print(\"Found accept button\")\n```\nIn this case we load all images in \"images/buttons/\" folder and the wait until start button is found. After that, it waits 2 seconds and then it tries to find accept button.\n\n\n##### Another example:\n```python\nimage_path = \"win10keyresized.PNG\"\nga = GuiAuto(detector=MultiscaledTMDetector())\nspot = ga.detect(cv2.imread(image_path), 0.8)\nif spot:\n ga.click(coords=spot.bottom_right(), clicks=3 )\n```\nIn this case we have a similar win10key image to our original located on our rendered screen. So using MultiscaledTMDetector fixes our problem resizing the screen multiple times. If it is detected, it clicks the bottom right of the image found three times.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marcosboggia/gui_automation", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "gui-automation", "package_url": "https://pypi.org/project/gui-automation/", "platform": "", "project_url": "https://pypi.org/project/gui-automation/", "project_urls": { "Homepage": "https://github.com/marcosboggia/gui_automation" }, "release_url": "https://pypi.org/project/gui-automation/3.0.3/", "requires_dist": null, "requires_python": "", "summary": "Simple python library useful for automating tasks using images.", "version": "3.0.3" }, "last_serial": 5725301, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "a46c2384fd2b8c58256cd106bf7b8d47", "sha256": "b6e848caf6f307ec120678d9415bb0f0411de13934ec37270ac2c77c99c345d2" }, "downloads": -1, "filename": "gui_automation-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "a46c2384fd2b8c58256cd106bf7b8d47", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5485, "upload_time": "2019-06-23T05:09:26", "url": "https://files.pythonhosted.org/packages/1f/fd/2ce1e5197321b6dee7439a83df48012767c4e4a939952f3dfd6833778d21/gui_automation-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69e2c89f71b5e5e63dac70e5f3940f3a", "sha256": "279f628d6f5c0277cf531bf7d0ff7924dccde03b28a82690708027bb9d065eae" }, "downloads": -1, "filename": "gui_automation-0.2.tar.gz", "has_sig": false, "md5_digest": "69e2c89f71b5e5e63dac70e5f3940f3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3174, "upload_time": "2019-06-23T05:09:30", "url": "https://files.pythonhosted.org/packages/3e/10/735935b256fa1bb1613f8320ab9f50aa360f7b4d6f746f5d93beda55a230/gui_automation-0.2.tar.gz" } ], "0.21": [ { "comment_text": "", "digests": { "md5": "0bb0ff85c4aa0684d6760297fdba4585", "sha256": "f75c1844857e82cdeb1dd36b449747aff709d28925923e9c2810d19683a0c9ff" }, "downloads": -1, "filename": "gui_automation-0.21-py3-none-any.whl", "has_sig": false, "md5_digest": "0bb0ff85c4aa0684d6760297fdba4585", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5494, "upload_time": "2019-06-23T05:09:29", "url": "https://files.pythonhosted.org/packages/d3/d2/e6cd008da079778abf00b76b979f8f9a7307e4e28346c559f18441133c29/gui_automation-0.21-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0a8011882649121e31cbc7f0a1e3949", "sha256": "2d8c041a7ce5ad85a3d6fab080ae5c71b53a0bcd021c352728be391e223e485c" }, "downloads": -1, "filename": "gui_automation-0.21.tar.gz", "has_sig": false, "md5_digest": "c0a8011882649121e31cbc7f0a1e3949", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3113, "upload_time": "2019-06-23T05:09:32", "url": "https://files.pythonhosted.org/packages/e1/0e/3282bbb837714409e867bcd19e7b37991e01e6d20739aec256cd4fbb68cb/gui_automation-0.21.tar.gz" } ], "1": [ { "comment_text": "", "digests": { "md5": "55c6533a6a439d8557005ac5b16bf2be", "sha256": "8ca2aeda85147d91bec4f327ef193bc88977e7a638d4d466720ea7144da51002" }, "downloads": -1, "filename": "gui_automation-1-py3-none-any.whl", "has_sig": false, "md5_digest": "55c6533a6a439d8557005ac5b16bf2be", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5486, "upload_time": "2019-06-23T05:27:28", "url": "https://files.pythonhosted.org/packages/df/ca/0719895ac5710bc603ca0a0816f6e098bb04a33b61dd30fadf8f87244c2a/gui_automation-1-py3-none-any.whl" } ], "2": [ { "comment_text": "", "digests": { "md5": "776f1c6d8e615a373e7637f6893a464a", "sha256": "1dda1f39b008011997d07109660ced2bd748d3b3ed88fd5944499d3c2e50ce77" }, "downloads": -1, "filename": "gui_automation-2-py3-none-any.whl", "has_sig": false, "md5_digest": "776f1c6d8e615a373e7637f6893a464a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6753, "upload_time": "2019-07-12T17:46:43", "url": "https://files.pythonhosted.org/packages/27/1b/df6266dfab11f20c7b8f24f4bcb564eaa43aa9af357993fb5828083018cc/gui_automation-2-py3-none-any.whl" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "f303330d7435820f9a6dfccd76595052", "sha256": "f356db97b4e8b57645e72f56eceed65218a0770e5a6374dbffa57e19d7a81ebe" }, "downloads": -1, "filename": "gui_automation-2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f303330d7435820f9a6dfccd76595052", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8586, "upload_time": "2019-07-31T19:24:43", "url": "https://files.pythonhosted.org/packages/35/44/934808494412b3baf3fa555e5fa9605d7d742cef368d02faa0816c035ab4/gui_automation-2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "49ba19a03e7f5d66e165a4002eb9f7b1", "sha256": "8d681b6ad80225ceb4016721457e4e0b1f7396c0962ce865697cf5d6fd1d7102" }, "downloads": -1, "filename": "gui_automation-2.1.tar.gz", "has_sig": false, "md5_digest": "49ba19a03e7f5d66e165a4002eb9f7b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5680, "upload_time": "2019-07-31T19:24:45", "url": "https://files.pythonhosted.org/packages/ef/50/3a8accf888e90743fd552289577326666db806fc2b04b16059c606a57d01/gui_automation-2.1.tar.gz" } ], "3": [ { "comment_text": "", "digests": { "md5": "f3a885b1b76d83d5e4f33e1c6ec946ec", "sha256": "a06e8164bfd3f9fc8bf9fd821f5d1bc2a0f8a3496073e4a340028682dcbb5f4d" }, "downloads": -1, "filename": "gui_automation-3-py3-none-any.whl", "has_sig": false, "md5_digest": "f3a885b1b76d83d5e4f33e1c6ec946ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14376, "upload_time": "2019-08-23T18:21:36", "url": "https://files.pythonhosted.org/packages/71/19/63c1fff5f6504d0f7fe9acc6865b393bc7935d0434abfc8c87cb716657f3/gui_automation-3-py3-none-any.whl" } ], "3.0.1": [ { "comment_text": "", "digests": { "md5": "012f3b3a4eac127562577d8d8835e51a", "sha256": "6d8efbf2547b381172a8e882eb900f4024f44ba6d92791543224bcf5ea00ce30" }, "downloads": -1, "filename": "gui_automation-3.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "012f3b3a4eac127562577d8d8835e51a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14909, "upload_time": "2019-08-23T19:10:22", "url": "https://files.pythonhosted.org/packages/19/06/9dc7136790f7da7f2d2e531b0ff75b52b7c6dfca94108d2ef5179601c69d/gui_automation-3.0.1-py3-none-any.whl" } ], "3.0.2": [ { "comment_text": "", "digests": { "md5": "346756e77abb9ae15bef395f9cd8055d", "sha256": "2dd9f3f3ea840a4720454ab341f48bd7fb8cc97bfb330e52cec59ba31f73bc6c" }, "downloads": -1, "filename": "gui_automation-3.0.2.tar.gz", "has_sig": false, "md5_digest": "346756e77abb9ae15bef395f9cd8055d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10662, "upload_time": "2019-08-23T22:36:54", "url": "https://files.pythonhosted.org/packages/43/d5/92bef930f0078daa26a3a072174b271d5e24a921e53874629cbe81b8b7fa/gui_automation-3.0.2.tar.gz" } ], "3.0.3": [ { "comment_text": "", "digests": { "md5": "4fc15d8f66ff814ad509edcef134f8e2", "sha256": "a186394016af4eca2006b44c550671a65742deae26dbc0e3b0d679a595a45651" }, "downloads": -1, "filename": "gui_automation-3.0.3.tar.gz", "has_sig": false, "md5_digest": "4fc15d8f66ff814ad509edcef134f8e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10991, "upload_time": "2019-08-24T20:47:09", "url": "https://files.pythonhosted.org/packages/78/ae/650ea2486d79271663a88b3c7c40401938db37c0bc8140208ccb32e5a1be/gui_automation-3.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4fc15d8f66ff814ad509edcef134f8e2", "sha256": "a186394016af4eca2006b44c550671a65742deae26dbc0e3b0d679a595a45651" }, "downloads": -1, "filename": "gui_automation-3.0.3.tar.gz", "has_sig": false, "md5_digest": "4fc15d8f66ff814ad509edcef134f8e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10991, "upload_time": "2019-08-24T20:47:09", "url": "https://files.pythonhosted.org/packages/78/ae/650ea2486d79271663a88b3c7c40401938db37c0bc8140208ccb32e5a1be/gui_automation-3.0.3.tar.gz" } ] }