manatlan / guy

Graphics User Ynterface : a simple module for making GUI applications (with html/js) for py3 ... to target windows, linux, mac & android
Apache License 2.0
203 stars 23 forks source link

Failed to load "guy.js" from daughter html file #7

Closed bendub closed 4 years ago

bendub commented 4 years ago

Hello Manatlan, The client side of my app is composed of a main html file with a frame displaying "daughter html page". The main html page can access the "guy.js" file when loaded but the daughter file can't i.e. when I inspect the page with Chromium DevTools, I found the following error: GET http://localhost:39000/guy.js net::ERR_ABORTED 404 (Not Found) I used guy v0.5.2. Thank you

manatlan commented 4 years ago

Hi bendub ... If I needed to make iframe, I'll do https://glitch.com/edit/#!/bendub?path=app.py:15:0 (source) (demo: https://bendub.glitch.me/)

the main instance is the container .. and the iframe contains an instance of another guy's window.

something like :

#!/usr/bin/env python
from guy import Guy

class Other(Guy):
  """
  <script>
  function hi(txt) {document.body.innerHTML+=txt}
  </script>
  """
  async def init(self):
    await self.js.hi("i'm the iframe")

class App(Guy):
  """
  <iframe src="Other"></iframe>
  <script>
  function hi(txt) {document.body.innerHTML+=txt}
  </script>
  """
  async def init(self):
    await self.js.hi("i'm the container")

if __name__ == "__main__": 
    App().serve()

Btw,you can "remix" the project ... and I will delete it after ... so you can get back "bendub" name ;-) glitch.com is a wonderful platform for guy's app is "server mode" ;-)

manatlan commented 4 years ago

the same thing on repl.it : https://repl.it/@manatlan/bendub ;-)

bendub commented 4 years ago

Thank you very much Manatlan, everything seems OK for me now.