forked from TDTP/pantallas-led
update example/poster.png
parent
8384e4f96a
commit
0493e8dc7e
|
@ -82,7 +82,8 @@ def main():
|
|||
theme = 'day'
|
||||
|
||||
# Alto y ancho de la imagen en pixeles
|
||||
height, width = 40, 160
|
||||
# height, width = 40, 160
|
||||
height, width = 200, 800
|
||||
|
||||
# Inicia el dibujo y setea el tema
|
||||
full_panel = MyDraw(height=height, width=width)
|
||||
|
@ -112,8 +113,9 @@ def main():
|
|||
|
||||
bus_announcement_1 = {
|
||||
'proportion': 0.6,
|
||||
'width_border': 2,
|
||||
'font_size': 11,
|
||||
'width_border': 3,
|
||||
# 'font_size': 11,
|
||||
'font_size': 80,
|
||||
'number_background_color': 'yellow',
|
||||
'letter_background_color': 'green',
|
||||
}
|
||||
|
@ -133,8 +135,9 @@ def main():
|
|||
|
||||
bus_announcement_2 = {
|
||||
'proportion': 0.6,
|
||||
'width_border': 2,
|
||||
'font_size': 11,
|
||||
'width_border': 3,
|
||||
# 'font_size': 11,
|
||||
'font_size': 80,
|
||||
'number_background_color': 'yellow',
|
||||
'letter_background_color': 'blue',
|
||||
}
|
||||
|
@ -145,7 +148,7 @@ def main():
|
|||
poster2.set_colors()
|
||||
# Se setea la ruta y la direccion en la que va
|
||||
poster2.set_bus_number(bus_number="16")
|
||||
poster2.set_bus_letter(bus_letter="I")
|
||||
poster2.set_bus_letter(bus_letter="H")
|
||||
|
||||
# Se agregan todas las imagenes al canvas
|
||||
full_panel.add_image(time_anmc1, (aprox((0.6)*width), aprox(0.05*height)))
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 14 KiB |
|
@ -6,7 +6,5 @@ data_path=$project_folder_path/data
|
|||
scripts_path=$project_folder_path/scripts
|
||||
assets_path=$project_folder_path/assets
|
||||
|
||||
|
||||
|
||||
# Ejecuta el contenedor con el enlace de carpeta local
|
||||
docker run --rm -d -p 8888:8888 --name make_poster -v $data_path:/app/data -v $assets_path:/app/assets -v $scripts_path:/app/scripts bus_poster
|
||||
docker run --rm -d -p 8888:8888 --name make_poster -v $data_path:/app/data -v $assets_path:/app/assets -v $scripts_path:/app/scripts -v $project_folder_path:/app bus_poster
|
|
@ -37,10 +37,12 @@ class BusPoster(MyDraw):
|
|||
def set_bus_number(self, bus_number="11"):
|
||||
text_color = 'black'
|
||||
width_border = self.prms['width_border']
|
||||
# width_border = 0
|
||||
text_bbox = self.font.getbbox(str(bus_number))
|
||||
font_width, font_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
|
||||
offset_width = np.round((self.prms['proportion']*self.width-width_border)/2) - np.round(font_width/2)
|
||||
text_position = (offset_width,0)
|
||||
# offset_width = 0
|
||||
text_position = (offset_width,-15)
|
||||
self.draw.text(
|
||||
text_position,
|
||||
bus_number,
|
||||
|
@ -57,7 +59,7 @@ class BusPoster(MyDraw):
|
|||
text_bbox = self.font.getbbox(str(bus_letter))
|
||||
font_width, font_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
|
||||
offset_width = np.round((proportion*self.width-width_border)) + 0.75*np.round(font_width/2)
|
||||
text_position = (1.1*offset_width,0)
|
||||
text_position = (1.1*offset_width,-15)
|
||||
self.draw.text(
|
||||
text_position,
|
||||
bus_letter,
|
||||
|
|
|
@ -45,7 +45,7 @@ class TimeAnnouncement(MyDraw):
|
|||
|
||||
text = "Tiempo aprox"
|
||||
text_color = self.theme_params['text_color']
|
||||
self.load_barlow(font_size=11)
|
||||
self.load_barlow(font_size=70)
|
||||
text_bbox = self.font.getbbox(text)
|
||||
base_font_width, base_font_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
|
||||
|
||||
|
@ -56,14 +56,14 @@ class TimeAnnouncement(MyDraw):
|
|||
else:
|
||||
text = f'{min_time} a {max_time} min'
|
||||
|
||||
self.load_barlow(font_size=12)
|
||||
self.load_barlow(font_size=70)
|
||||
text_bbox = self.font.getbbox(text)
|
||||
font_width, font_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
|
||||
# print(font_width, font_height)
|
||||
offset_width = (np.round((self.width-self.border)) - np.round(font_width))/2
|
||||
offset_height = (np.round((self.height-self.border)) - np.round(base_font_height))/2
|
||||
# text_position = (offset_width,5+offset_height)
|
||||
text_position = (offset_width,offset_height)
|
||||
text_position = (offset_width,offset_height-10)
|
||||
# text_position = (0, 0)
|
||||
self.draw.text(
|
||||
text_position,
|
||||
|
|
Loading…
Reference in New Issue