Skip to content

Commit 119a7d0

Browse files
author
Margaret Matocha
committed
Limited pylint cleanup of examples
1 parent dfe6899 commit 119a7d0

File tree

2 files changed

+42
-47
lines changed

2 files changed

+42
-47
lines changed

examples/display_text_label_vs_bitmap_label_alternating.py

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
# import textmap
99
# from textmap import textBox
1010

11+
import gc
12+
import time
1113
import board
1214
import displayio
1315
import terminalio
14-
import fontio
15-
import sys
16-
import time
17-
import busio
16+
from adafruit_bitmap_font import bitmap_font
1817

1918
from adafruit_display_text import bitmap_label
2019

@@ -26,7 +25,7 @@
2625
##########
2726
# Use this Boolean variables to select which font style to use
2827
##########
29-
use_builtin_font = True # Set True to use the terminalio.FONT BuiltinFont,
28+
use_builtinfont = True # Set True to use the terminalio.FONT BuiltinFont,
3029
# Set False to use a BDF loaded font, see "fontFiles" below
3130
##########
3231

@@ -99,11 +98,11 @@
9998
# 'fonts/BitstreamVeraSans-Roman-16.bdf', # mainText
10099
]
101100

102-
from adafruit_bitmap_font import bitmap_font
101+
103102

104103
for i, fontFile in enumerate(fontFiles):
105104

106-
if use_builtin_font:
105+
if use_builtinfont:
107106
thisFont = (
108107
terminalio.FONT
109108
) # comment this out to switch back to BDF loaded fonts
@@ -113,12 +112,10 @@
113112
fontList.append(thisFont)
114113

115114

116-
preloadTheGlyphs = (
117-
True # set this to True if you want to preload the font glyphs into memory
118-
)
115+
preload_glyphs = True # set this to True if you want to preload the font glyphs into memory
119116
# preloading the glyphs will help speed up the rendering of text but will use more RAM
120117

121-
if preloadTheGlyphs:
118+
if preload_glyphs:
122119

123120
# identify the glyphs to load into memory -> increases rendering speed
124121
glyphs = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-,.:?! "
@@ -134,13 +131,11 @@
134131
print("Fonts completed loading.")
135132

136133
# create group
137-
import gc
138-
139134

140-
myString1 = "This is a label.py and\nbitmap_label.py comparison."
141-
myString23 = "none"
142-
myString_bitmap_label = "bitmap_label"
143-
myString_label = "label bitmap_label"
135+
my_string1 = "This is a label.py and\nbitmap_label.py comparison."
136+
my_string23 = "none"
137+
my_string_bitmap_label = "bitmap_label"
138+
my_string_label = "label bitmap_label"
144139

145140

146141
#####
@@ -151,9 +146,9 @@
151146

152147
bmap_label1 = bitmap_label.Label(
153148
font=fontList[0],
154-
text=myString1,
149+
text=my_string1,
155150
color=0xFFFFFF,
156-
max_glyphs=len(myString1),
151+
max_glyphs=len(my_string1),
157152
background_color=0xFF0000,
158153
padding_bottom=0,
159154
padding_left=0,
@@ -170,9 +165,9 @@
170165
label2_padding = 10
171166
bmap_label2 = bitmap_label.Label(
172167
font=fontList[0],
173-
text=myString23,
168+
text=my_string23,
174169
color=0x000000,
175-
max_glyphs=len(myString23),
170+
max_glyphs=len(my_string23),
176171
background_color=0xFFFF00,
177172
padding_bottom=label2_padding,
178173
padding_left=0,
@@ -189,9 +184,9 @@
189184

190185
bmap_label3 = bitmap_label.Label(
191186
font=fontList[0],
192-
text=myString23,
187+
text=my_string23,
193188
color=0x000000,
194-
max_glyphs=len(myString23),
189+
max_glyphs=len(my_string23),
195190
background_color=0xFFFF00,
196191
padding_bottom=0,
197192
padding_left=0,
@@ -206,9 +201,9 @@
206201

207202
bmap_label4 = bitmap_label.Label(
208203
font=fontList[0],
209-
text=myString_label,
204+
text=my_string_label,
210205
color=0x000000,
211-
max_glyphs=len(myString_label),
206+
max_glyphs=len(my_string_label),
212207
background_color=0xFFFF00,
213208
padding_bottom=0,
214209
padding_left=0,
@@ -221,12 +216,12 @@
221216
scale=my_scale,
222217
)
223218

224-
myString5 = "bitmap_label -->"
219+
my_string5 = "bitmap_label -->"
225220
bmap_label5 = bitmap_label.Label(
226221
font=fontList[0],
227-
text=myString5,
222+
text=my_string5,
228223
color=0xFFFFFF,
229-
max_glyphs=len(myString5),
224+
max_glyphs=len(my_string5),
230225
background_color=0x000000,
231226
padding_bottom=0,
232227
padding_left=0,
@@ -261,9 +256,9 @@
261256

262257
label1 = label.Label(
263258
font=fontList[0],
264-
text=myString1,
259+
text=my_string1,
265260
color=0xFFFFFF,
266-
max_glyphs=len(myString1),
261+
max_glyphs=len(my_string1),
267262
background_color=0xFF0000,
268263
padding_bottom=0,
269264
padding_left=0,
@@ -280,9 +275,9 @@
280275

281276
label2 = label.Label(
282277
font=fontList[0],
283-
text=myString23,
278+
text=my_string23,
284279
color=0x000000,
285-
max_glyphs=len(myString23),
280+
max_glyphs=len(my_string23),
286281
background_color=0xFFFF00,
287282
padding_bottom=label2_padding,
288283
padding_left=0,
@@ -299,9 +294,9 @@
299294

300295
label3 = label.Label(
301296
font=fontList[0],
302-
text=myString23,
297+
text=my_string23,
303298
color=0x000000,
304-
max_glyphs=len(myString23),
299+
max_glyphs=len(my_string23),
305300
background_color=0xFFFF00,
306301
padding_bottom=0,
307302
padding_left=0,
@@ -316,9 +311,9 @@
316311

317312
label4 = label.Label(
318313
font=fontList[0],
319-
text=myString_label,
314+
text=my_string_label,
320315
color=0x000000,
321-
max_glyphs=len(myString_label),
316+
max_glyphs=len(my_string_label),
322317
background_color=0xFFFF00,
323318
padding_bottom=0,
324319
padding_left=0,
@@ -332,12 +327,12 @@
332327
)
333328

334329

335-
myString5 = "<-- label"
330+
my_string5 = "<-- label"
336331
label5 = label.Label(
337332
font=fontList[0],
338-
text=myString5,
333+
text=my_string5,
339334
color=0xFFFFFF,
340-
max_glyphs=len(myString5),
335+
max_glyphs=len(my_string5),
341336
background_color=0x000000,
342337
padding_bottom=0,
343338
padding_left=0,

examples/display_text_label_vs_bitmap_label_simpletest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,33 @@
88
# import textmap
99
# from textmap import textBox
1010

11+
import gc
12+
import time
1113
import board
1214
import displayio
1315
import terminalio
14-
import gc
15-
import time
16+
1617

1718
##########
1819
# Use these Boolean variables to select the text display library and which font style to use
1920
##########
20-
use_bitmap_label = True # Set True if to use 'bitmap_label.py'
21+
use_bitmaplabel = True # Set True if to use 'bitmap_label.py'
2122
# Set False to use 'label.py' library
2223
##########
23-
use_builtin_font = True # Set True to use the terminalio.FONT BuiltinFont,
24+
use_builtinfont = True # Set True to use the terminalio.FONT BuiltinFont,
2425
# Set False to use a BDF loaded font, see "fontFiles" below
2526
##########
2627

2728

2829
my_scale = 1
2930

30-
if use_bitmap_label: # use bitmap_label.py library (Bitmap)
31+
if use_bitmaplabel: # use bitmap_label.py library (Bitmap)
3132
from adafruit_display_text import bitmap_label as label
3233

3334
version = "bitmap_label.py"
3435

3536
else: # use label.py library (TileGrid)
36-
from adafruit_display_text import label as label
37+
from adafruit_display_text import label
3738

3839
version = "label.py"
3940

@@ -106,7 +107,7 @@
106107

107108
for i, font_file in enumerate(font_files):
108109

109-
if use_builtin_font:
110+
if use_builtinfont:
110111
this_font = (
111112
terminalio.FONT
112113
) # comment this out to switch back to BDF loaded fonts
@@ -138,7 +139,6 @@
138139
print("Fonts completed loading.")
139140

140141
# create group
141-
import gc
142142

143143
gc.collect()
144144
print("After creating Group, Memory free: {}".format(gc.mem_free()))

0 commit comments

Comments
 (0)