viewtopic.php?f=8&t=22229
But something goes wrong. (This issue looks slightly different than original, so I created a new topic.)
The code:
Code: Select all
init python:
style.opaqbar = Style(style.default)
style.opaqbar.idle_left_bar = Frame(config_font_meter_off, 0,0)
style.opaqbar.idle_right_bar = Frame(config_font_meter_off, 0,0)
style.opaqbar.hover_left_bar = Frame(config_font_meter_on, 0,0)
style.opaqbar.hover_right_bar = Frame(config_font_meter_on, 0,0)
style.opaqbar.xmaximum = opaqbar_x
style.opaqbar.ymaximum = opaqbar_y
style.opaqbar.idle_thumb = config_meter_handle_off
style.opaqbar.hover_thumb = config_meter_handle_on
style.opaqbar.thumb_shadow = None
style.opaqbar.thumb_offset = 16 #half of the wide of the thumb image
style.opaq_mask = Style(style.default)
style.opaq_mask.background = Transform(Frame(config_opaque_mask, 0,0), alpha=persistent.saywindow_opacity)Code: Select all
screen fontback_opaque_bar:
bar:
value FieldValue(persistent, "saywindow_opacity", range=1.0, style="slider")
xpos x_p ypos y_p
style "opaqbar"
changed update_mask_opacity()
screen window_opaque_test:
frame:
style "opaq_mask"
pos(x_f, y_f)Code: Select all
init -2 python:
#Function for the frame opacity state updating
def update_mask_opacity():
style.opaq_mask.background = Transform(Frame(config_opaque_mask, 0,0), alpha=persistent.saywindow_opacity)
style.rebuild()Looks like the update_mask_opacity() function runs not only on slider position change, but repeatedly after the program run.
Is there another way to run style.rebuild() to update the opacity state of the frame?
