Plugin Development

If you have a question or need help, this is the place to be.
Post Reply
Posts: 38
Joined: Wed Jun 07, 2017 8:30 pm

Plugin Development

Post by cvben » Fri Jan 05, 2018 3:37 am

So I've been thinking about a project for myself to create an eventghost plugin toward some end. I'll probably do something with a program, lets say ShareX, an excellent screenshot utility for example. Lacking a tutorial on this I have been dredging through the included plugins and seeing how they do what they are doing. Exploring modules, imports, methods, etc. I have looked a bit into utilizing named pipes and it seems graspable (who knows if I'm getting it yet, but I'll keep at it). I'm just looking for general tips, what modules to look at, strategy, pitfalls. It sounds like a lot I now, but youtube videos, online tutorials, books to buy, and simple sage advice is much appreciated.

I think more than anything what I am wondering is how to "observe" the various threads, processes, methods of a program. From there I can poke and prod, hopefully learning something along the way.

Honestly, this sounds like a hassle reading over it, but like I said, even an "atta boy" might do :)

User avatar
Site Admin
Posts: 5498
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Plugin Development

Post by kgschlosser » Fri Jan 05, 2018 7:41 am

Hey ya gotta start somewhere. It is ambitious i'll give you that.

As far as integrating with a piece of software make sure it has the ability to be controlled from some external means. This can be done in several ways. It can be done with a named pipe, or a TCP socket. I have seen some programs use the Windows Notification system. Older programs may use dde. You have to figure out what it uses if any at all.

As far as a screenshot plugin. I would suggest using the ImageGrab library and the PIL (Pillow) library. these come pre installed into EG and can handle just about every single type of image You also have the ability to manipulate the image, resizing, sharpness, contrast. a whole mess of things. PIL is pretty easy to use.

Download PyCharm Community Edition It's a python IDE.

If you want to use pyCharm you are going to need to have python installed. I just keyed up this script you can run from inside of EG. you need to paste this into a PythonScript action and then run the action.

What this script is going to do is it will download and install stackless Python 2.7 and then upgrade the modules installers. after that it will install any modules that EG uses and it will make a copy of your EG installation (only the core python files) into the site-packages folder of the python install. This will get you up and running for developing and eliminate most errors that may show up in the IDE. there are a bunch that are still going to show up but this is going to minimize them.

I have not tested this code so I do not know if it will run without error.


Code: Select all

import threading

def run():
    import eg
    import requests
    import tempfile
    import os
    from subprocess import Popen
    from shutil import copytree, rmtree
    stackless_url = ''
    stackless_args = '" /quiet /passive /qn /norestart'
    stackless_install_path = r'c:\StacklessPython27'

    new_stackless_path = raw_input(
        'Enter New path to install Python into.\n'
        'Or leave blank to use the default of\n'

    if new_stackless_path:
        stackless_install_path = new_stackless_path

    stackless = requests.get(stackless_url).content
    tmp_dir = tempfile.mkdtemp()

    stackless_installer = os.path.join(tmp_dir, 'python-2.7.12150-stackless.msi')
    with open(stackless_installer, 'w') as f:

    p = Popen(
        'msiexec /I "{0}" {1} "{2}"'.format(
    stdout, stderr = p.communicate()
    print stdout

    scripts_dir = os.path.join(stackless_install_path, 'scripts')
    pip = os.path.join(scripts_dir, 'pip')

    p = Popen(
        '"{0}" install --upgrade setup_tools'.format(pip)
    stdout, _ = p.communicate()
    print stdout

    p = Popen(
        '"{0}" --upgrade pip'.format(os.path.join(scripts_dir, 'easy_install'))
    stdout, _ = p.communicate()
    print stdout

    mods = [

    for mod in mods:
        mod = '' + mod

        p = Popen('"{0}" install {1}'.format(pip, mod))
        stdout, _ = p.communicate()
        print stdout

        os.path.join(eg.mainDir, 'eg'),
        os.path.join(stackless_install_path, 'Lib', 'site-packages', 'eg')

t = threading.Thread(target=run)
t.daemon = True
If you like the work I have been doing then feel free to Image

Post Reply