def receive_event(self, event): bl.printf(0, 0, ' ') bl.printf(0, 0, str(event))
def drawRect(x, y, width, height): for w in xrange(width): for h in xrange(height): terminal.printf(x + w, y + h, "[U+2588]")
import PyBearLibTerminal as terminal terminal.open() terminal.printf(2, 1, "β") terminal.put(2, 2, "β") terminal.refresh() while True: if terminal.has_input(): key = terminal.read() print(key) if key == terminal.TK_Q | terminal.TK_KEY_RELEASED: print("released") break elif key == terminal.TK_Q: break terminal.close()
cmap = bltColor.color_map([bltColor('red').trans(0), 'blue', bltColor('red').trans(0)], [0,25,50]) cmap2 = bltColor.color_map(['blue', bltColor('red').trans(0), 'blue'], [0,25,50]) key = None terminal.composition(True) while True: terminal.clear() x, y = 10, 15 terminal.color(red) terminal.printf(0,0, "red") terminal.color(green) terminal.printf(5, 0, "green") terminal.color(blue) terminal.printf(12, 0, "blue") #print red #print type(red) terminal.color('white') terminal.printf(18,0, ": {0}, {1}, {2} | type: {3}".format(red, green, blue, type(red))) terminal.color(n_red) terminal.printf(0,1, "red") terminal.color(n_green) terminal.printf(5, 1, "green")