@@ -358,35 +358,23 @@ def show_badge(self, *, background_color=0xFF0000, foreground_color=0xFFFFFF,
358358 (int (self .display .height * 0.5 )), fill = foreground_color )
359359 splash .append (rect )
360360
361- if isinstance (hello_font , str ):
362- hello_font = load_font (hello_font , hello_string )
363- hello_group = displayio .Group (scale = hello_scale )
364- hello_label = Label (font = hello_font , text = hello_string , line_spacing = 0.75 )
365- (_ , _ , width , _ ) = hello_label .bounding_box
366- hello_label .x = ((self .display .width // (2 * hello_scale )) - width // 2 )
367- hello_label .y = int (self .display .height * (0.117 / hello_scale ))
368- hello_label .color = background_text_color
369- hello_group .append (hello_label )
370-
371- if isinstance (my_name_is_font , str ):
372- my_name_is_font = load_font (my_name_is_font , my_name_is_string )
373- my_name_is_group = displayio .Group (scale = my_name_is_scale )
374- my_name_is_label = Label (font = my_name_is_font , text = my_name_is_string , line_spacing = 0.75 )
375- (_ , _ , width , _ ) = my_name_is_label .bounding_box
376- my_name_is_label .x = ((self .display .width // (2 * my_name_is_scale )) - width // 2 )
377- my_name_is_label .y = int (self .display .height * (0.28 / my_name_is_scale ))
378- my_name_is_label .color = background_text_color
379- my_name_is_group .append (my_name_is_label )
380-
381- if isinstance (name_font , str ):
382- name_font = load_font (name_font , name_string )
383- name_group = displayio .Group (scale = name_scale )
384- name_label = Label (font = name_font , text = name_string , line_spacing = 0.75 )
385- (_ , _ , width , _ ) = name_label .bounding_box
386- name_label .x = ((self .display .width // (2 * name_scale )) - width // 2 )
387- name_label .y = int (self .display .height * (0.65 / name_scale ))
388- name_label .color = foreground_text_color
389- name_group .append (name_label )
361+ hello_group = self ._create_label_group (text = hello_string ,
362+ font = hello_font ,
363+ scale = hello_scale ,
364+ height_adjustment = 0.117 ,
365+ color = background_text_color )
366+
367+ my_name_is_group = self ._create_label_group (text = my_name_is_string ,
368+ font = my_name_is_font ,
369+ scale = my_name_is_scale ,
370+ height_adjustment = 0.28 ,
371+ color = background_text_color )
372+
373+ name_group = self ._create_label_group (text = name_string ,
374+ font = name_font ,
375+ scale = name_scale ,
376+ height_adjustment = 0.65 ,
377+ color = foreground_text_color )
390378
391379 group = displayio .Group ()
392380 group .append (splash )
0 commit comments