Merge pull request #1287 from PySimpleGUI/Dev-latest
Added a repl.it link to the top.
This commit is contained in:
commit
f623f9e67e
|
@ -7,6 +7,12 @@ else:
|
||||||
|
|
||||||
'''
|
'''
|
||||||
A chat window. Add call to your send-routine, print the response and you're done
|
A chat window. Add call to your send-routine, print the response and you're done
|
||||||
|
|
||||||
|
To see this program RUN on the web go here:
|
||||||
|
https://repl.it/@PySimpleGUI/Chat-Application-Demo
|
||||||
|
|
||||||
|
Note that the size of the display on repl.it is smaller than most, so the sizes of the
|
||||||
|
Multiline and Output text areas were reduced in the online version. Nothing else was changed
|
||||||
'''
|
'''
|
||||||
|
|
||||||
sg.ChangeLookAndFeel('GreenTan') # give our window a spiffy set of colors
|
sg.ChangeLookAndFeel('GreenTan') # give our window a spiffy set of colors
|
||||||
|
@ -17,16 +23,19 @@ layout = [[sg.Text('Your output will go here', size=(40, 1))],
|
||||||
sg.ReadButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True),
|
sg.ReadButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True),
|
||||||
sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]]
|
sg.Button('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]]
|
||||||
|
|
||||||
window = sg.Window('Chat window', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2)).Layout(layout)
|
window = sg.Window('Chat window',
|
||||||
|
default_element_size=(30, 2),
|
||||||
|
font=('Helvetica',' 13'),
|
||||||
|
default_button_element_size=(8,2)).Layout(layout)
|
||||||
|
|
||||||
# ---===--- Loop taking in user input and using it --- #
|
# ---===--- Loop taking in user input and using it --- #
|
||||||
while True:
|
while True:
|
||||||
(event, value) = window.Read()
|
(event, value) = window.Read(timeout=0)
|
||||||
if event is 'SEND':
|
if event is 'SEND':
|
||||||
query = value['query'].rstrip()
|
query = value['query'].rstrip()
|
||||||
# EXECUTE YOUR COMMAND HERE
|
# EXECUTE YOUR COMMAND HERE
|
||||||
print('The command you entered was {}'.format(query))
|
print('The command you entered was {}'.format(query))
|
||||||
elif event is None or event == 'EXIT': # quit if exit button or X
|
elif event in (None, 'EXIT'): # quit if exit button or X
|
||||||
break
|
break
|
||||||
sys.exit(69)
|
sys.exit(69)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue