New "launcher" demo program

Initial checkin
This commit is contained in:
MikeTheWatchGuy 2018-08-09 06:53:13 -04:00
parent 90925af23e
commit 4962b02799
2 changed files with 40 additions and 0 deletions

36
Demo_Script_Launcher.py Normal file
View File

@ -0,0 +1,36 @@
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()

4
SimScript_.py Normal file
View File

@ -0,0 +1,4 @@
import time
for i in range(100):
print(i,'', end='')