Advanced Python Programming - GUI Automation with PyAutoGUI

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ม.ค. 2025

ความคิดเห็น • 334

  • @TheCodex
    @TheCodex  5 ปีที่แล้ว +16

    Interested in learning more about PyAutoGUI? Enroll in TheCodex and take our Python Automation course that covers PyAutoGUI in-depth! thecodex.me/courses/python-automation

    • @prince-gv3cv
      @prince-gv3cv 3 ปีที่แล้ว

      Hi! What software do i need to install for my windows 10? I dont know any programming but i think this will help me with my work since its routinary. Thank you so much.

    • @TestTest-yx5yv
      @TestTest-yx5yv 3 ปีที่แล้ว

      how can you have that panel at the bottom? mine just looks like a command prompt.

    • @TechtonicIN
      @TechtonicIN 3 ปีที่แล้ว

      Hey ! i cant figure out how to convert pyautogui to exe

    • @briarhugo3650
      @briarhugo3650 3 ปีที่แล้ว

      You prolly dont give a shit but does anybody know a tool to get back into an instagram account..?
      I was dumb lost the login password. I appreciate any tricks you can give me

    • @lianzayne8843
      @lianzayne8843 3 ปีที่แล้ว

      @Briar Hugo Instablaster :)

  • @justforme__
    @justforme__ 5 ปีที่แล้ว +9

    YOU HAVE NO IDEA HOW THANKFUL I AM FOR THIS VIDEO

  • @TheCodex
    @TheCodex  6 ปีที่แล้ว

    Take your skills one step further with The Complete Python Programming Bootcamp! www.thecodex.me/python-bootcamp
    Join THECODEX today! www.thecodex.me

  • @porkpy2187
    @porkpy2187 2 ปีที่แล้ว +3

    Mindblow. I've been wanting to develop machine learning agents to play video games for years, but have always failed to find a general way of combining the ML code with the game on the screen. Thanks man!

  • @nurbsnerd1483
    @nurbsnerd1483 6 ปีที่แล้ว +35

    You can use SHIFT+Command+4 to get the XY co-ordinate on a Mac. It is the screenshot shortcut but works much better than running the print position command everytime.

    • @danixboxgamer
      @danixboxgamer 5 ปีที่แล้ว +1

      this comment is underated!

  • @xx_ironicusername_xx3919
    @xx_ironicusername_xx3919 4 ปีที่แล้ว +2

    there's a simpler way to find information about mouse position now, open a python shell and do this:
    import pyautogui
    pyautogui.displayMousePosition()
    when you run it, you will routinely be given back both the position and the RGB colour value of the pixel the mouse is on, please note that I'm not a programmer, and I've just picked this up when learning pyautogui

  • @luimu
    @luimu 4 ปีที่แล้ว +161

    I thought this was about creating GUIs automatically

    • @mythocrat
      @mythocrat 4 ปีที่แล้ว +3

      😂 😂 😂 😂

    • @MrJoJI
      @MrJoJI 4 ปีที่แล้ว

      Lol

    • @billwerth2
      @billwerth2 4 ปีที่แล้ว +10

      Me too. Instead, maybe the worst advice on how to automate a web page.

    • @dityadion249
      @dityadion249 4 ปีที่แล้ว

      Me too

    • @last1b4free
      @last1b4free 4 ปีที่แล้ว

      LOLL

  • @markph0204
    @markph0204 5 ปีที่แล้ว +5

    Using absolute positioning on the desktop is not without problems. You can never guarantee the positioning of screens for example. But if you are the one automating a task, it makes sense that you can position things properly. But I would dread the setup each time.

    • @CainanParker
      @CainanParker 5 ปีที่แล้ว +1

      Mark Hurley that’s what I was thinking, I’m wondering if you could get by using a series of ‘tabs’ to get to the search bar instead? That would then work no matter what you’re running it on

    • @LuxBacelo
      @LuxBacelo 5 ปีที่แล้ว

      You can use screen scrapping and OCR to get a feedback of the situation.

  • @odai11
    @odai11 4 ปีที่แล้ว

    2 mins into the video and my problem was solved, thanks a lot man

  • @jimlo
    @jimlo 3 ปีที่แล้ว

    Found this video just now, great tutorial, helped me out quite a bit!

  • @zlackbiro
    @zlackbiro 5 ปีที่แล้ว +168

    In Java, you must write 104524 lines of code just do define Mouse Cursor... 😂 Pyhon 2 lines! ❤️

    • @darkinferno4687
      @darkinferno4687 5 ปีที่แล้ว +33

      cant u save the 104524 lines as a module and import it when needed?

    • @waynezor
      @waynezor 5 ปีที่แล้ว +40

      @@darkinferno4687 which is exactly what you're doing in python by 'import pyautogui'

    • @darkinferno4687
      @darkinferno4687 5 ปีที่แล้ว +8

      @@waynezor that's what im trying to say
      its the same

    • @waynezor
      @waynezor 5 ปีที่แล้ว +8

      @@darkinferno4687 Yes, I was just trying to expand your point, because it seemed like OP was implying that you can do that in Python in two lines simply because python is so concise (and that java is bad because it is not), which is simply untrue (rather it's because there's a module for practically anything in python).

    • @nelsonvon2444
      @nelsonvon2444 5 ปีที่แล้ว +1

      @@waynezorIs there one for this in Java?
      My point is Advantage of Java over C++ is modules.
      If Java has less modules than Python then Oops.

  • @mitchelllockyer6970
    @mitchelllockyer6970 6 ปีที่แล้ว +4

    I've been trying to work this out for ages and this video was exactly what I was looking for

  • @quackersdackers4004
    @quackersdackers4004 4 ปีที่แล้ว

    dude you have saved me my packages didnt work but now with this pycharm feature i can do so much

  • @wigi3503
    @wigi3503 4 ปีที่แล้ว

    I was searching for something diffrent, but this is really usefull too, thanks :D

  • @salimchougule869
    @salimchougule869 4 ปีที่แล้ว +1

    I had no clue this would be soo easy thank you soo much bro

  • @sharonalexander7254
    @sharonalexander7254 5 ปีที่แล้ว +4

    Where were you all this time....:D
    This is amazing...

  • @jamesanatole625
    @jamesanatole625 4 ปีที่แล้ว +1

    This is rlly helpful - thank you so much for this since you covered it so well 🙂

  • @CyberBreacher
    @CyberBreacher 4 ปีที่แล้ว +1

    loved your video keep it up !

  • @kanikan8660
    @kanikan8660 4 ปีที่แล้ว

    Very well explained in a timely matter. Great job!!!

  • @AlexanderPrussak
    @AlexanderPrussak 6 ปีที่แล้ว +2

    wow, your tutorials are very good and on point

  • @deepakarthikeyan3109
    @deepakarthikeyan3109 4 ปีที่แล้ว

    Nice presentation.thanks for sharing

  • @melitajay
    @melitajay 4 ปีที่แล้ว

    Very concise and easy!

  • @RubixCubed3
    @RubixCubed3 5 ปีที่แล้ว +4

    Can you use pyautogui to select certain html elements? Pixel positions are fixed and depending on monitor and if the page is maximized or not sometimes pixel positions can be off

    • @sunmoonstarkiwi
      @sunmoonstarkiwi 3 ปีที่แล้ว

      Same question.
      If the data source is dynamic and next query generates a different format.

  • @seydinabadiane8761
    @seydinabadiane8761 5 ปีที่แล้ว +3

    just amazing ! dude you're the best

  • @gamning7689
    @gamning7689 4 ปีที่แล้ว +1

    This is awesome, i want to learn more

  • @Arcsecant
    @Arcsecant 5 ปีที่แล้ว +2

    Fantastic, this is going to make automating testing my database user interface so much easier.

  • @mazenmaharoof3270
    @mazenmaharoof3270 2 ปีที่แล้ว

    Hey could you make a video explaining all the functions of the pyautogui module
    Please

  • @MarkoBrainz
    @MarkoBrainz 4 ปีที่แล้ว +2

    This is really cool! I put this in a while True loop and then I wanted to stop it😂😂 But it was continuously teleporting and writing "test" LOL!

    • @justsomeguy6545
      @justsomeguy6545 3 ปีที่แล้ว

      That is why you add a kill switch smh

  • @shreeshind8388
    @shreeshind8388 4 ปีที่แล้ว

    Thanx bro very helpfulllll😍

  • @sonamtseringsherpa
    @sonamtseringsherpa 4 ปีที่แล้ว

    Amazing and explained nice and easy!

  • @avibank
    @avibank 5 ปีที่แล้ว +1

    Thanks Avi. Regards, Avi.

  • @jhonyvoz
    @jhonyvoz 5 ปีที่แล้ว +1

    amazing google chrome theme how do you do? is there a video?

  • @sahartal9503
    @sahartal9503 6 ปีที่แล้ว +7

    Thanks you, this is very helpful :)

  • @vidyacollections
    @vidyacollections 3 ปีที่แล้ว

    We want o create a virtual centos operating system and we need to open GUI using selenium webdriver in non headless mode and want to run some pyAutoGui cases.....is it possible.....if so could you please give some insights like how to enable non headless mode, how to enable mouse click etc...

  • @temal32
    @temal32 3 ปีที่แล้ว

    thanks, helped me a lot!

  • @RC-bl2pm
    @RC-bl2pm 5 ปีที่แล้ว +2

    what happens if you move your program to another device/ change screen resolution/ minmax screen to half size?

  • @jhonyvoz
    @jhonyvoz 5 ปีที่แล้ว +2

    it is pretty helpful. Thanks

  • @uilium
    @uilium 5 ปีที่แล้ว +2

    What if the browser moves? Are the x,y coordinates relative to the browser or the entire screen?

    • @raderh2o
      @raderh2o 5 ปีที่แล้ว

      nope . but dragRel and moveRel can move youre mouse relative to its position

    • @LatinDanceVideos
      @LatinDanceVideos 5 ปีที่แล้ว

      In selenium it's easy to use named objects in webpages to access specific buttons.
      I'm not convinced gui programming on desktop programs will be easy. Still useful skill.

  • @gameknightplayz
    @gameknightplayz ปีที่แล้ว

    this seems great thank you

  • @codeispoetry
    @codeispoetry 3 ปีที่แล้ว

    thanks for this - great tutorial that really helped :)

  • @dharmang
    @dharmang 5 ปีที่แล้ว +2

    its works perfectly on linux i have tested it a month ago i guess. :)
    just wanted to know more features on pyautogui

    • @pawelpow
      @pawelpow 4 ปีที่แล้ว

      Hi! Whenever I type pip install pyautogui on linus terminal it says package not found. Can you do me a favor and assist me

  • @msz6683
    @msz6683 5 ปีที่แล้ว +1

    I believe that pyobjc is short for "python objective c", not object.

  • @DCMPSaliva
    @DCMPSaliva 3 ปีที่แล้ว

    If this is done by pixel position then it will be exclusive to the screen you program it on ?

  • @chesshooligan1282
    @chesshooligan1282 4 ปีที่แล้ว

    This is cool, but I reckon Autohotkey is much better for Windows GUI automation. It can detect open windows, maximise them, minimise them, move files around, copy them, delete them, detect the colour of a pixel on the screen, detect whether a key on your keyboard is pressed or not, detect open processes, loop through all the existing files in a folder, create timers, create simple GUIs, output text and simple geometric figures on the screen, and a lot more. It has many more features than PyAutoGUI. The only downside is the syntax is a bit weird and it takes a few days to get used to it, but once you do, you'll wonder how you could live without it before.

  • @minevr5839
    @minevr5839 4 ปีที่แล้ว

    Love it. Thank you.

  • @opensourcesabout8128
    @opensourcesabout8128 3 ปีที่แล้ว

    I like the background , Borobudur Temple ..

  • @lzh3362
    @lzh3362 2 ปีที่แล้ว

    Hello, I'd want to know if it's possible to use pyautogui to automate clicks without sacrificing the functionality of my cursor as I use pyautogui to automate clicks, however my cursor becomes useless while the script is running since it moves across the screen.

  • @PpekKOX1337
    @PpekKOX1337 2 ปีที่แล้ว

    Hey bro how can I make the python script read out the data from a .txt file and then type it somewhere?

  • @parapara8585
    @parapara8585 5 ปีที่แล้ว +1

    amazing. thanks for sharing. Keep it up the good work.

  • @rakeshparmar8943
    @rakeshparmar8943 4 ปีที่แล้ว

    Very useful sir

  • @electricz3045
    @electricz3045 3 ปีที่แล้ว

    How i can bind it to a specific windows so it only choose the coordinates in discord as example. also the position is different on different screens so how would i do it so it clicks buttons by a id or smh?

  • @Rhys-gv3ir
    @Rhys-gv3ir 4 ปีที่แล้ว

    Is there a way you can store the x and y coordinates when clicking,
    so you can then input those coordinates into a function that will automatically click at that location

  • @nicolasalmeida7673
    @nicolasalmeida7673 3 ปีที่แล้ว

    I have a desktop program installed on the machine, I wanted PyAutoGui to change data on it, but the simple fact of putting the focus on the program no PyAutoGui command works on it.
    What can it be?
    Is there any blocking for some programs?

  • @kaalbhairav7721
    @kaalbhairav7721 4 ปีที่แล้ว

    It's Py Objective C, a bridge between Python and Objective-C.

  • @REZ1-b6i
    @REZ1-b6i 3 ปีที่แล้ว

    As like you selected 280, 74 as a position in screen,,,,,,I wanna make a program to detect any change of the text in a particular position on the screen,,,,,how can i do that?

  •  4 ปีที่แล้ว

    Hello TheCodex! Hope you're well.
    I have a problem with .press('enter') in the dropdown menu. Please help me how can I click enter on the option? Because it clicks but nothing is happening.
    Thanks.

  • @jaynj908
    @jaynj908 4 ปีที่แล้ว

    I use a tiling window manager on Linux and I was trying to use the hotkeys in VS code and I was getting strange results from just going to the search box and not typing anything to going to the Home Depot website to my file directory. I just pushed the run arrow in VS code and it worked fine.

  • @brpawankumariyengar4227
    @brpawankumariyengar4227 6 ปีที่แล้ว +1

    Great Video .... thank you very much for posting. I will get started on this ASAP

  • @pranaypankaj2159
    @pranaypankaj2159 2 ปีที่แล้ว

    what would be the command if you wanted to typewrite the up arrow key?

  • @aditikhandelwal135
    @aditikhandelwal135 3 ปีที่แล้ว

    How we can automate Desktop apps using python OCR based approach?

  • @moali1836
    @moali1836 4 ปีที่แล้ว

    Can you run excel access etc via this gui?

  • @rannyarcher29
    @rannyarcher29 4 ปีที่แล้ว

    thank u so so so so so so so so much bro !

  • @JonathanRintala
    @JonathanRintala 5 ปีที่แล้ว

    Python is 🔥 Great video

    • @agent6124
      @agent6124 2 ปีที่แล้ว +1

      i think you secretly love java (your picture)

    • @JonathanRintala
      @JonathanRintala 2 ปีที่แล้ว

      @@agent6124 oops you got me ;)

  • @0namey
    @0namey 6 ปีที่แล้ว

    04:06
    Hi,
    I'm using Pycharm Community Edition 2018.3.2 on Windows 7, and ctrl+shift+r do not work. How to fix that?

    • @AlexanderPrussak
      @AlexanderPrussak 6 ปีที่แล้ว

      shift+f10 to start an instance, can be used to run multiple instances
      ctrl+f5 to rerun your program
      ctrl+f2 (or shift+f2?) to stop your code

  • @peterperker9733
    @peterperker9733 4 ปีที่แล้ว

    Maybe you can try taking screen shot of the search bars "search icon" and do
    search = pyautogui.locateOnScreen( "search_icon.png" confidence=0.9)
    Pyautogui.click(search)

  • @dominicdannies7482
    @dominicdannies7482 5 ปีที่แล้ว +1

    what is better in your view: Selenium or PyAutoGUI ?

  • @phuctran-dh3le
    @phuctran-dh3le 4 ปีที่แล้ว

    Can I use python to write automatic touch and gesture for ios devices

  • @sillycovek
    @sillycovek 2 ปีที่แล้ว

    I always get an error trying to install any packages whit PIP.
    I'm on windows 10 but typing "pip install pyautogiu" into the terminal promp just gives me an error

  • @nathanheath3756
    @nathanheath3756 6 ปีที่แล้ว +3

    Couldn’t you use selenium ? Although this is pretty cool

    • @TheCodex
      @TheCodex  6 ปีที่แล้ว +2

      You absolutely could. PyAutoGUI allows you to take over your computer's controls and do as you please - Selenium is intended for browser automation. But for the example in the video, Selenium would have been the better choice!

  • @ardram5296
    @ardram5296 6 ปีที่แล้ว +1

    Is this good module for desktop app automation?

  • @Romanslost
    @Romanslost 4 ปีที่แล้ว

    I've used python in the past but I'm wondering if I can take the data from an excel sheet, store it and then iterate through + paste into another application (using pyautogui)?

    • @Romanslost
      @Romanslost 4 ปีที่แล้ว

      @@vald0285 I do have a discord, at least I'd be able to explain it better.

    • @Romanslost
      @Romanslost 4 ปีที่แล้ว

      @@vald0285 Raf#9910

  • @adventurousmale
    @adventurousmale 5 ปีที่แล้ว +1

    starts at 03:48

  • @alguien157
    @alguien157 5 ปีที่แล้ว +1

    Now This is An Avengers Level Threat

  • @sirbobbyuk
    @sirbobbyuk 5 ปีที่แล้ว

    I think im having problems with the x and y co-ordinates, when i press control+shift and r i dont think im seeing the correct co-ordinates. So that when i entering the numbers in the click sections and i run the code the browser doesnt populate with Hello world and enter doesnt execute the search.

  • @denissopichev5986
    @denissopichev5986 4 ปีที่แล้ว

    what are the use cases? I think most apps has API

  • @arnabdutta3578
    @arnabdutta3578 5 ปีที่แล้ว

    Excellent one. Thanks, can you please share more on this library

  • @MrYewenghoe
    @MrYewenghoe 4 ปีที่แล้ว

    Can PyAutoGUI be used for GNU/Linux desktop?

  • @dharmalesmana3433
    @dharmalesmana3433 4 ปีที่แล้ว

    sorry mr, i dont understand what are you create ?, can you explain me how to work your porgram ?

  • @HerosInDiapers
    @HerosInDiapers 5 ปีที่แล้ว

    Can it work with objects? Or Just with mouse positions?

  • @PrieyudhaAkaditaS
    @PrieyudhaAkaditaS 4 ปีที่แล้ว

    Is it possible to use this without any cursor/mouse plugged in?

  • @TSaqo
    @TSaqo 5 ปีที่แล้ว

    liked your video using this xD

  • @oceansblue692
    @oceansblue692 5 ปีที่แล้ว

    Help is needed if possible. Using VS Code, on Win10. pyautogui.hotkey('control', 'c')
    is behaving completely different. it is not copying but instead pasting another URl from the browser history.
    Not too sure why or how it is doing that.
    Here is my complete lines of code:
    import pyautogui
    pyautogui.click(1136, 63)
    pyautogui.hotkey('control', 'c')

  • @aainfos
    @aainfos 3 ปีที่แล้ว

    Thanks Boss worked

  • @syedjunaidali6612
    @syedjunaidali6612 5 ปีที่แล้ว

    can you tell how we can make our made script as a button or something like that, which is clicked or opened and the script runs?

    • @effab1e200
      @effab1e200 5 ปีที่แล้ว

      Google how to convert a py file to an executable(.exe)

  • @rcfanatic101
    @rcfanatic101 6 ปีที่แล้ว

    Does pyautogui have anything like the WinActive and Control functions in Autohotkey? I am looking for an alternative that's cross-platform and can still detect certain things like window names and controls. I can't really use screen coordinates because the gui elements change position all the time in the software that I want to automate, so that's where the Control functions would come in. It would allow me to take a specific window control and click it relative to its position, rather than relative to the mouse or screen.

    • @jtekmmx
      @jtekmmx 6 ปีที่แล้ว

      Look into Winium and PyWinAuto

  • @cz48b1
    @cz48b1 5 ปีที่แล้ว

    AWESOME!!!!! Thanks for sharing

  • @kaavyakumar1683
    @kaavyakumar1683 4 ปีที่แล้ว

    When I do the pyautogui.click it's not actually clicking. It's not even moving the mouse there. I even tried copying exactly the code in the video, but it didn't even work then. I use mac. Do you know why this may be happening?

  • @chaosbro9743
    @chaosbro9743 4 ปีที่แล้ว

    amazing guide bro. i was wondering if you could make a qutomation guide for android (by python if it's possible) too, because i didn't find a clear and easy guide for that. thank you!

  • @zhabokot
    @zhabokot 4 ปีที่แล้ว

    while doing so, I encounter a problem " 'scratch_9' is not allowed to run in parallel." strange, but just 1 script is running...

  • @anabakhtar3774
    @anabakhtar3774 4 ปีที่แล้ว

    will this work if we have trackpad disabled in our laptop ? just intrigued if it works on hardware level too

  • @JaaOffendJaa
    @JaaOffendJaa 5 ปีที่แล้ว

    can we use image recognition to find the mouse coordinate using that and take that input and do the hello world and so on ....

  • @CryptoRootz
    @CryptoRootz 6 ปีที่แล้ว

    how do i get it to click on the search bar? its not working im using python 3.6 idle ? i followed everything exactly...

  • @iwoz
    @iwoz 7 ปีที่แล้ว

    Hey Nice work. will this work in the background? i mean without the active screen.

  • @g-etes-tec7700
    @g-etes-tec7700 6 ปีที่แล้ว +1

    Verz helpful tuts // Thank u very much for the videos

  • @mandeepvayeda8029
    @mandeepvayeda8029 5 ปีที่แล้ว

    can I pass variable as an argument in .typewrite method?? If so , how?

  • @Insomniac_Insights
    @Insomniac_Insights 4 ปีที่แล้ว

    How can I Automate games similar to piano tiles of PC version? With pyautogui?

  • @raoulsporleder1852
    @raoulsporleder1852 4 ปีที่แล้ว

    Is there any way you can run an automation and still use your pc?

  • @KUMARIKAVITA424
    @KUMARIKAVITA424 4 ปีที่แล้ว

    can we assign this copied data in one variable . How?

  • @ecptavares
    @ecptavares 4 ปีที่แล้ว

    when I do this code it does not click on the browser where the mouse position is instead it writes inside PYCharm whre the cursor is.

  •  5 ปีที่แล้ว

    What a great video. Subscribed, liked, and commented
    #earnedit