class Index(guy.Guy): """ <a href="Search?q=yo1">yo1</a> <a href="Search?q=yo2">yo2</a> <button onclick="self.jcall()">jcall vx</button> <button onclick="guy.emit('hello','X')">Emit X</button> <script> guy.init( function() { guy.on("hello",function(x) { document.body.innerHTML+=x; }) }) function set(v) { guy.emitMe("hello",v) } </script> """ size=(200,200) async def init(self): await self.js.set("ok") self.set("vx") def set(self,v): self.v=v async def jcall(self): await self.js.alert(self.v)
class Init(guy.Guy): size=(200,200) __doc__=""" <script> guy.init( function() { setInterval( function(){ self.display('X')}, 1000) }) </script>""" def display(self,x): print(x)
class Cfg(guy.Guy): size = (300, 20) __doc__ = """ <script> guy.init( async function(){ document.body.innerHTML += await guy.cfg.kiki; }) </script> """ def __init__(self, d): guy.Guy.__init__(self) self.d = d def init(self): self.cfg.kiki = self.d
class Search(guy.Guy): """ <script> guy.init( function() { guy.on("hello",function(x) { document.body.innerHTML+=x; }) }) function set(v) { guy.emitMe("hello",v) } </script> <h1>Search <<q>></h1> <button onclick="self.jcall()">jcall vs</button> <button onclick="guy.emit('hello','S')">Emit S</button> <button onclick="self.testOpen()">testOpen</button> """ size=(200,200) def __init__(self,q): self.q=q guy.Guy.__init__(self) async def init(self): await self.js.set("ok") self.set("vs") def set(self,v): self.v=v async def jcall(self): await self.js.alert(self.v) def testOpen(self): return Simplest()
class Fetch(guy.Guy): # name the class as the web/<class_name>.html size = guy.FULLSCREEN __doc__ = """
class Cam(guy.Guy): __doc__ = """