Python - Allow the user to specify the text to scroll via a command line flag. (#252)

* Accept the text to scroll as a command line parameter.  If not text flag is given, then the default, "Hello world", is used.
This commit is contained in:
Roberto Marquez 2017-01-05 00:58:23 -06:00 committed by Henner Zeller
parent 3f47b57598
commit 6e41022019
2 changed files with 2 additions and 1 deletions

View file

@ -14,7 +14,7 @@ class RunText(SampleBase):
font.LoadFont("../../fonts/7x13.bdf")
textColor = graphics.Color(255, 255, 0)
pos = offscreenCanvas.width
myText = "Hello World!"
myText = self.args["text"]
while True:
offscreenCanvas.Clear()

View file

@ -14,6 +14,7 @@ class SampleBase(argparse.ArgumentParser):
self.add_argument("-p", "--pwmbits", action = "store", help = "Bits used for PWM. Something between 1..11. Default: 11", default = 11, type = int)
self.add_argument("-l", "--luminance", action = "store_true", help = "Don't do luminance correction (CIE1931)")
self.add_argument("-b", "--brightness", action = "store", help = "Sets brightness level. Default: 100. Range: 1..100", default = 100, type = int)
self.add_argument("-t", "--text", help="The text to scroll on the RGB LED panel", default = "Hello world!")
self.args = {}