I've actually, wonderfully, found what I was looking for, by accident, with the following setup:
button.present('popover')
button.action ⇒ view.present()
view::button_item.action ⇒ view.alpha = 0 ⇒ clean, transparent view to the console log
without the initial popover button, setting view.alpha = 0 results in a black, opaque screen.
seems the popover enables something specific for transparency…
here's a working example:
import ui
import time
view = ui.View()
view.frame = (0, 0, 240, 240)
view.flex = 'WH'
view.background_color = 'white'
def alphaaction(sender):
print(view.alpha)
if view.alpha == 1.0:
view.alpha = 0.0
sender.tint_color = 'red'
else:
view.alpha = 1.0
sender.tint_color = 'black'
alphabutton = ui.ButtonItem()
alphabutton.action = alphaaction
alphabutton.title = 'alpha'
alphabutton.tint_color = 'black'
view.right_button_items = [alphabutton]
button = ui.Button()
button.action = lambda x: view.present()
button.frame = (0,0,40,40)
button.background_color = '#9cd8a1'
if False:
view.present() # => black screen
else:
button.present('popover') # => transparent screen
@ui.in_background
def run():
k = 0
while True:
print("### test", k, "###")
k += 1
time.sleep(0.5)
run()