MCPcopy Index your code
hub / github.com/rawpython/remi / main

Method main

examples/onclose_window_app.py:20–34  ·  view source on GitHub ↗
(self, name='world')

Source from the content-addressed store, hash-verified

18
19class MyApp(App):
20 def main(self, name='world'):
21 # margin 0px auto allows to center the app to the screen
22 wid = gui.VBox(width=300, height=200, margin='0px auto')
23
24 lbl = gui.Label("Close or reload the page, the console thread will stop automatically.")
25 wid.append(lbl)
26
27 # add the following 3 lines to your app and the on_window_close method to make the console close automatically
28 tag = gui.Tag(_type='script')
29 tag.add_child("javascript", """window.onunload=function(e){remi.sendCallback('%s','%s');return "close?";};""" % (
30 str(id(self)), "on_window_close"))
31 wid.add_child("onunloadevent", tag)
32
33 # returning the root widget
34 return wid
35
36 def on_window_close(self):
37 # here you can handle the unload

Callers

nothing calls this directly

Calls 2

add_childMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected