It is currently 12 Aug 2020, 15:54

• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

GIMP/GL:  Tutorials | Tips | Questions | 🡆 Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

How to automatically switch tools in GIMP through scripts/plug-ins

GIMP or GIMP LEARN Forum Interests
Post Reply
tim
GL Blogger

How to automatically switch tools in GIMP through scripts/plug-ins

Post#1 by tim » 19 Jun 2019, 04:09


There is no API or pdb_ calls to switch front end tools (like auto switching to another tool) in GIMP.
However, if you install the simplest one to use is pyautogui library for python which provides ways for you to send keys/mouse events to the interface, then you can switch the tools.
I am on Linux so I only know how to install pyautogui for Python 2.7 which my GIMP uses with the below commands
pip install pyautogui
pip install python-xlib
After that inside GIMP.
I added an extra import statement as below:
from pyautogui import press, typewrite, hotkey
then at end of script, if I wanted it to auto-switch to the Move tool for example by hitting the 'm' key
then i added the line
press('m')
more details on pyautogui here -> https://pyautogui.readthedocs.io/en/lat ... sheet.html
I imagine this can be done on windows too, the .py script/plug-in doesn't need to be changed but the installation of pyautogui might be different on Windows. If you're on Windows and you've successfully installed pyautogui and got plug-ins to successfully switch tool like I menioned...please add answer below (to out knowledge base).
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
1


GIMP/GL:  Tutorials | Tips | Questions | 🡆 Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 10 guests