Spaces:
Runtime error
Runtime error
Update process_energy.py
Browse files- process_energy.py +3 -3
process_energy.py
CHANGED
@@ -178,19 +178,19 @@ def create_affirmation_frame(text, width=640, height=480, duration=5):
|
|
178 |
draw = ImageDraw.Draw(frame)
|
179 |
|
180 |
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Path font default
|
181 |
-
font_size = 18
|
182 |
|
183 |
# Menggunakan font default
|
184 |
try:
|
185 |
font = ImageFont.truetype(font_path, font_size)
|
186 |
except IOError:
|
187 |
font = ImageFont.load_default()
|
188 |
-
|
189 |
lines = text.split('\n')
|
190 |
total_height = sum([draw.textbbox((0, 0), line, font=font)[3] - draw.textbbox((0, 0), line, font=font)[1] for line in lines])
|
191 |
y_text = (height - total_height) // 2
|
192 |
|
193 |
-
|
194 |
bbox = draw.textbbox((0, 0), line, font=font)
|
195 |
width_text = bbox[2] - bbox[0]
|
196 |
height_text = bbox[3] - bbox[1]
|
|
|
178 |
draw = ImageDraw.Draw(frame)
|
179 |
|
180 |
font_path = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" # Path font default
|
181 |
+
font_size = 18 # Ukuran font yang lebih kecil
|
182 |
|
183 |
# Menggunakan font default
|
184 |
try:
|
185 |
font = ImageFont.truetype(font_path, font_size)
|
186 |
except IOError:
|
187 |
font = ImageFont.load_default()
|
188 |
+
|
189 |
lines = text.split('\n')
|
190 |
total_height = sum([draw.textbbox((0, 0), line, font=font)[3] - draw.textbbox((0, 0), line, font=font)[1] for line in lines])
|
191 |
y_text = (height - total_height) // 2
|
192 |
|
193 |
+
for line in lines:
|
194 |
bbox = draw.textbbox((0, 0), line, font=font)
|
195 |
width_text = bbox[2] - bbox[0]
|
196 |
height_text = bbox[3] - bbox[1]
|