Skip to content

Commit

Permalink
#25 two way comms established between Python and ng with an effective…
Browse files Browse the repository at this point in the history
…ly but roundabout api
  • Loading branch information
InBrewJ committed Jul 4, 2019
1 parent 6baf2ca commit b433095
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions gui/lrpi/lrpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@
# See also: https://github.com/r0x0r/pywebview/blob/master/examples/todos/assets/script.js

class Api():

def sendToIonic(self, message):
print(message, 'sent!')


def fileResponse(self, param):
webview.evaluate_js("""
pywebview.api.sendToIonic('Good!').then(function(response) {
alert('Done!')
})
""")

def event(self, param):
print('select audio file!')
self.fileResponse('Good!')


# def load_html():
# webview.evaluate_js("""
# pywebview.api.event().then(function(response) {
# alert('Yeah?')
# })
# """)

if __name__ == '__main__':
# t = threading.Thread(target=load_html)
Expand Down

0 comments on commit b433095

Please sign in to comment.