diff --git a/WelcomeScreen.py b/WelcomeScreen.py index 542f847..3c7382a 100644 --- a/WelcomeScreen.py +++ b/WelcomeScreen.py @@ -28,24 +28,40 @@ class WelcomeScreen: def show(self, cycles=1): # loops says how often the Starting text goes through if cycles < 1: cycles = 1 padding = " " * self.columns # as much spaces as padding as one display line is long + padding_hyphen = "-" * self.columns # as much hyphens as padding as one display line is long starting_str = "Starting..." started_str = "Started!".center(self.columns) + # mechanism for centering on a 4*20 display + y_offset = 0 + if self.lines == 4: + y_offset = 1 + # also clear the top and bottom with ---- + self.lcd.move_to(0,0) + self.lcd.putstr(padding_hyphen) + self.lcd.move_to(0,4) + self.lcd.putstr(padding_hyphen) + for i in range(cycles): line1 = padding + starting_str + padding line2 = "The Program!".center(self.columns) for i in range(self.columns + len(starting_str)): + self.lcd.move_to(0,y_offset) self.lcd.putstr(line1[0:self.columns]) - self.lcd.move_to(0,1) + self.lcd.move_to(0,y_offset+1) self.lcd.putstr(line2[0:self.columns]) line1 = line1[1:] - self.lcd.move_to(0,0) + self.lcd.move_to(0,y_offset) self.lcd.putstr(started_str) # now fade down + if self.lines == 4: + current_display = padding_hyphen + started_str + "The Program!".center(self.columns) + padding_hyphen + else: + current_display = started_str + "The Program!".center(self.columns) time.sleep(1) - self.lcd.move_to(0,0) + self.lcd.move_to(0,y_offset) self.lcd.putstr(padding + started_str) time.sleep(0.1) self.lcd.clear()