Skip to content

Vertical label Proposal #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

Vertical label Proposal #122

wants to merge 9 commits into from

Conversation

jposada202020
Copy link
Contributor

As discussed during the meeting, proposal for vertical label.

Considerations
-It is true that the new architecture will change dramatically display_text, however this improvement could improve the text_label proper.
-A Vertical Progress bar with horizontal text is not very appealing

This is a Prototype to open the conversation and not a Final Version,
and (more or less, a lot of adjusting) the background box is an improvement for the text label

In an interesting topic, you will need to test this in a physical screen, blinka does not work. I tested the code below in a WIO Terminal using Adafruit CircuitPython 6.1.0

Maybe it could be included in the community bundle. I let you folks decide. (Iy you want my opinion label text should be more open to other languages, where you write from top to bottom, and from left to right)
@FoamyGuy @jepler @kmatch98

@jepler reporting that it could be done :). Thanks for the info, and if it was you also for the amazing transpose_xy function

import board
import displayio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label_vertical

display = board.DISPLAY
group = displayio.Group(max_size=12)

text = "CircuitPythoñ"
MEDIUM_FONT = bitmap_font.load_font("/fonts/Helvetica-Bold-16.bdf")

text_area = label_vertical.Label(MEDIUM_FONT, text=text, color=0x00FF00, background_color=0x990099, x=50, y=180)

group.append(text_area)
display.show(group)

while True:
    pass

@jposada202020
Copy link
Contributor Author

image

@jposada202020
Copy link
Contributor Author

image
This is ready for some reviews. Thanks.

Test Code:

import board
import displayio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label_vertical
from adafruit_display_text import label
import time

display = board.DISPLAY
group = displayio.Group(max_size=12)

text = "Reporting"
MEDIUM_FONT = bitmap_font.load_font("/fonts/Helvetica-Bold-16.bdf")
BIG_FONT = bitmap_font.load_font("/fonts/LeagueSpartan-Bold-16.bdf")


bitmap = displayio.Bitmap(320, 5, 2)
palette = displayio.Palette(2)
palette[0] = 0x004400
palette[1] = 0x00FFFF
tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette, x=10, y=160)

bitmap2 = displayio.Bitmap(3, 220, 2)
tile_grid2 = displayio.TileGrid(bitmap2, pixel_shader=palette, x=120, y=10)





text_area3 = label_vertical.Label(BIG_FONT,
 text="Pythoñ", 
 color=0x00FF00, 
 background_color=0x990022,  
 background_tight=False, 
 padding_top=5, 
 padding_bottom=0, 
 padding_left=0,
 padding_right=0,
 x=120,
 y=80,
 base_alignment= True,
 scale=1,)
group.append(text_area3)

text_area4 = label_vertical.Label(MEDIUM_FONT,
 text="Circuit", 
 color=0x00FF00, 
 background_color=0x990099,  
 background_tight=False, 
 padding_top=4, 
 padding_bottom=15, 
 padding_left=10,
 padding_right=3,
 base_alignment= True,
 x=120,
 y=140
 ,)
group.append(text_area4)
text_area = label_vertical.Label(MEDIUM_FONT, text="V6.2.0",
 color=0x00FF00, background_color=0x330099, padding_left=0,
  padding_right=0, padding_bottom=0, padding_top=0, anchor_point=(0.0, 0.0),
  anchored_position=(130,120),
  scale=2,)
text_area2 = label.Label(MEDIUM_FONT,
 text=text, color=0xAA5522, 
 background_color=0x22FF44, 
 padding_left=0, 
 padding_right=0, 
 padding_bottom=0, 
 padding_top=0, 
 x=20,
 y=140)

group.append(text_area)
group.append(text_area2)

group.append(tile_grid)
group.append(tile_grid2)
display.show(group)

while True:
    pass

x=position_x,
y=position_y,
)
face.transpose_xy = True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Line will make the MagTag crash and go to safe mode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adafruit/circuitpython#4331 Seems to solve the problem. For testing see PR.

@jposada202020
Copy link
Contributor Author

Closed, this will be introduced as a Feature in label.py. I found a way to make it work with label. New PR will come after REFACTOR in display_text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant