GUI Tools
There are a lot of parts in the gui module that are complicated, need implementing or lack clarity when reading. That is where this framework comes in.
Colours
One of the most commonly used parts of this module is the Colours class. This gives clarity when coding so that you can see the colour you have set as words instead of as 3 numbers which can be hard to visualise.
import gui
from gui_utils import Colours, FG_COLOUR, BG_COLOUR
gui.show([
[gui.DL_COLOR(Colours.gold)],
[gui.DL_POINT_SIZE(100)],
[gui.PRIM_POINTS,[gui.DL_VERTEX2F(400, 240)]]
])
This also makes it easier to keep consistency across your code and avoid mistakes that can come via typos.
Currently you may notice that many of the colours on widgets are unchangeable, this can be (partially) fixed using some of the functions in this module.
import gui
from gui_utils import Colours, FG_COLOUR, BG_COLOUR
def scroll_cb(b):
pass
val = [1]
gui.show([
[gui.DL_COLOR(Colours.gold)],
FG_COLOUR(Colours.red),
BG_COLOUR(Colours.blue),
[gui.CTRL_SCROLLBAR, 100, 240, 600, 20, [1], 0xFFFF, val, scroll_cb]
])
Here FG_COLOUR and BG_COLOUR return the display-list commands to set the foreground and background colours.