class root.RootWidget(Widget)
For the GUI to function, there must be exactly one instance of
RootWidget. It implements the main event loop and serves as the
ultimate container for all other visible widgets.
Constructor
- RootWidget(surface)
- Initialises the root widget with the given surface, which will normally be the PyGame screen, but could be a subsurface of it.
Attributes
- redraw_every_frame
- If true, all widgets will be redrawn on every animation frame (i.e. after every call to begin_frame()). If false, redrawing only occurs after user input events, such as mouse clicks and keystrokes, or if a widget calls its invalidate() method. The default is false.
Methods
- set_timer(interval)
- Arranges for the begin_frame() method to be called every interval milliseconds.
- run(modal_widget = None)
- Runs the main event loop. If a modal_widget is given, it is run as a modal dialog until its dismiss method is called. Otherwise, control is retained until a QUIT event is received, whereupon the quit() method is called.
- quit()
- This method is called when a QUIT event is received. The default implementation calls sys.exit(0).
Abstract Methods
- begin_frame()
- Called at the beginning of each frame time, as determined by a previous call to set_timer.
---