Fix Pango layout extents error in draw_year_markers
- Replace get_extents() with get_pixel_size() for correct text measurement - Fixes ValueError: not enough values to unpack error - get_pixel_size() returns (width, height) tuple directly in pixels
This commit is contained in:
parent
a94b01c4d8
commit
d9c8bb8e34
@ -542,9 +542,8 @@ class MyTimelineView(NavigationView):
|
||||
)
|
||||
layout.set_text(str(year), -1)
|
||||
|
||||
(x_bearing, y_bearing, text_width, text_height, x_advance, y_advance) = layout.get_extents()
|
||||
text_width = text_width / Pango.SCALE
|
||||
text_height = text_height / Pango.SCALE
|
||||
# Get text size in pixels
|
||||
text_width, text_height = layout.get_pixel_size()
|
||||
|
||||
context.set_source_rgb(0.0, 0.0, 0.0) # Black
|
||||
context.move_to(timeline_x - 20 - text_width, y_pos - text_height / 2)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user