Added WelcomeScreen.py with the basic class (copied from micronEC/welcome.py)
This commit is contained in:
parent
c330d11e2c
commit
6e74bf3be0
51
WelcomeScreen.py
Normal file
51
WelcomeScreen.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
"""
|
||||||
|
WelcomeScreen: A simple library providing a customizable welcome screen fading over an LCD
|
||||||
|
Copyright (C) 2024 Benjamin Burkhardt
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
"""
|
||||||
|
WelcomeScreen:
|
||||||
|
provide a simple welcome/startup screen
|
||||||
|
"""
|
||||||
|
class WelcomeScreen:
|
||||||
|
def __init__(self, lcd):
|
||||||
|
self.lcd = lcd
|
||||||
|
|
||||||
|
def show_welcome(self, loops=1): # loops says how often the Starting text goes through
|
||||||
|
if loops < 1: loops = 1
|
||||||
|
padding = " " # 16 spaces
|
||||||
|
started_str = " Started! "
|
||||||
|
|
||||||
|
for i in range(loops):
|
||||||
|
line1 = padding + "Starting..." + padding
|
||||||
|
line2 = " the Program "
|
||||||
|
for i in range(32):
|
||||||
|
self.lcd.putstr(line1[0:16])
|
||||||
|
self.lcd.move_to(0,1)
|
||||||
|
self.lcd.putstr(line2[0:16])
|
||||||
|
line1 = line1[1:]
|
||||||
|
|
||||||
|
self.lcd.move_to(0,0)
|
||||||
|
self.lcd.putstr(started_str)
|
||||||
|
|
||||||
|
# now fade down
|
||||||
|
time.sleep(2)
|
||||||
|
self.lcd.move_to(0,0)
|
||||||
|
self.lcd.putstr(padding + started_str)
|
||||||
|
time.sleep(0.1)
|
||||||
|
self.lcd.clear()
|
Loading…
Reference in New Issue
Block a user