Other functions

RGB

Used to create a colour that can then be entered into gui.DL_COLOR() to display colour as shown below:

col = gui.RGB(255,0,0)

gui.show([
    [gui.DL_COLOR(col)],
    [gui.CTRL_TEXT, 400, 240, 30, 1536, 'RED TEXT'],
])

Alternatively, you can use DL_COLOR_RGB():

gui.show([
    [gui.DL_COLOR_RGB(255,0,0)],
    [gui.CTRL_TEXT, 400, 240, 30, 1536, 'RED TEXT'],
])

disable callbacks

While coding on the Touch products there may be points where you want to disable callbacks from certain events.

gui.disable_cb(gui.EVT_PRESS)

Disables callbacks from a specific event function. If you want to disable all callbacks from micropython then see upy callbacks. To enable the event again you have to redefine what you want the event function to be as this function sets the event callback function to be NULL.

toggle press

If you need to disable the ability to press on the screen you can use the enable_press function.

gui.enable_press(state)

state is a boolean of the state of the press. True is pressing is enabled, False is pressing is disabled.

get the display list

If you need to get the display list at run time this is the function to do so:

gui.get_list()

This will return the display list that it is displaying at the time.

get_max_dl_ram

When you need to see if you are running out of space in the amount you have devoted to your display list on the RAM you can use the get_max_dl_ram function.

gui.get_max_dl_ram()

This then returns the amount of space in use.

pause callbacks

You can pause all callbacks from the gui module using the pause() function. We often do so at the beginning of the file before we have loaded everything in.

gui.pause(state)

This will set the current pause state based on the boolean for state that you pass it. If you want to see what state it is in; call the function without any parameters.

redraw

Redraws everything in the gui.show()

gui.redraw()

show

Takes an input parameter of a single list of commands that can be used to display on the screen.

gui.show(display_list)

swipe_info

Returns info about a swipe.

gui.swipe_info()

Returns: (swiping=False, x0=0, y0=0, dx=0, dy=0)

  • swiping = True or False based on whether there is currently a swipe taking place.

  • x0 = x coordinate of the start of the swipe

  • y0 = y coordinate of the start of the swipe

  • dx = change in x from the start of the swipe to the end of the swipe

  • dy = change in y from the start of the swipe to the end of the swipe

This is used with the EVT_SWIPE and swipe_cb as when used here it will give useful information about a swipe. See Swipe.