Making a Python script accessible

Hey !

I wrote some scripts to automatize repetitive tasks for my colleagues using python.

Today I execute it for them and send the output through email.

I want to "give" them the script so they can use it whenever they want. I was thinking on making a GUI with tkinter, or making it available through a web app maybe ?

They are totally not tech savvy so teaching them command line will take too much time.

What would be your advice ?

Thanks 🐍!

16 comments · 67% upvoted · other discussions

comments

MikeTheWatchGuy

Can you install Python on their systems? If so...

Toss a GUI onto the front-end of your utilities and then let users double-click the .py file. It'll launch straight into a GUI.

Try PySimpleGUI to get up and running in a few minutes to see what it feels like to use your programs with a GUI. It's worth the 5 minutes it'll take.

pip install PySimpleGUI

Docs

http://pysimplegui.readthedocs.io/

GitHub

https://github.com/MikeTheWatchGuy/PySimpleGUI

MikeTheWatchGuy

Here is a launcher application:

import PySimpleGUI as sg
import os

def Launcher():

    form = sg.FlexForm('Script launcher')
    layout =  [
                [sg.Text('Script output....', size=(40, 1))],
                [sg.Output(size=(88, 20))],
                [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')]
              ]

    form.Layout(layout)
    # ---===--- Loop taking in user input and using it to query HowDoI --- #
    while True:
        (button, value) = form.Read()
        if button == 'EXIT' or button is None:
            break           # exit button clicked
        if button == 'script1':
            ExecuteCommandOS('python SimScript.py')
        elif button == 'script2':
            ExecuteCommandOS('python SimScript.py')
        elif button == 'Enter':
            ExecuteCommandOS(value[0])      # send string without carriage return on end


def ExecuteCommandOS(command):
    output = os.popen(command).read()
    print(output)


if __name__ == '__main__':
    Launcher()

The code produces the following GUI:

https://user-images.githubusercontent.com/13696193/43874104-df3340e8-9b57-11e8-8c03-c5610d5530c3.jpg

The output from the script will be shown in the window above the buttons. Add as many buttons as you want. Associate buttons to any scripts you want to offer to run.

oh-my-python [OP]

:O thank you I am going to try it right away :D

MikeTheWatchGuy

Let me know how it goes or if you have any problems. Interested in getting feedback on how to package is working for you.

oh-my-python [OP]

I will :)