question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Label: halign does not work. text always centered

See original GitHub issue

Text always shows centered, regardless of halign parameter.

import kivy

from kivy.app import App
from kivy.uix.label import Label

class P(App):
    def build(self):
        return Label(text='Text',halign='left')


P().run()

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
zplorer52commented, Jun 25, 2018

I have used these for Label text in the kv file to align text. it works… thanks lexelby. text_size:self.size halign:‘left’ valign:‘middle’

4reactions
lexelbycommented, Oct 12, 2014

In KV, I tried texture_size: self.size. I got left-justified text, but the text was stretched to the size of the Label. text_size: self.size leaves the text unstretched and seems to allow halign to work.

I’m still not completely sure I understand the mechanisms at work here, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kivy button text alignment (halign) doesn't work - Stack Overflow
According to the documentation for halign : This doesn't change the position of the text texture of the Label (centered), only the position ......
Read more >
halign problem - Google Groups
halign problem. 481 views ... I'm trying to use the halign property of a Label and can't get it to work ... However...
Read more >
Label — Kivy 2.1.0 documentation
The valign property will have no effect and halign will only have an effect if your text has newlines; a single line of...
Read more >
How to Keep Form Labels Aligned - Quick Tips - Balsamiq
A neat trick to keep labels in Balsamiq wireframes aligned even after editing them. ... Just center-align the text in the property inspector...
Read more >
Align text left or right, center text, or justify text on a page
For example, in a paragraph that is left-aligned (the most common alignment), the left edge of the paragraph is flush with the left...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found