Skip to content
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

toga.Label() text_align problem on Android #1128

Closed
soucosmo opened this issue Oct 31, 2020 · 4 comments
Closed

toga.Label() text_align problem on Android #1128

soucosmo opened this issue Oct 31, 2020 · 4 comments
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior.

Comments

@soucosmo
Copy link

soucosmo commented Oct 31, 2020

Pack(text_align='center') and Pack(text_align=CENTER) doesn't function as expected on Android.


Original report

Pack(text_align='center') ou Pack(text_align=CENTER) não funciona no android, estou usando Debian 10, ao executar briefcase dev funciona normalmente o alinhamento, apenas no android não funciona.

@soucosmo soucosmo added the bug A crash or error in behavior. label Oct 31, 2020
@freakboy3742
Copy link
Member

Without a complete reproduction case, it's impossible to verify this report.

@sictmfx
Copy link

sictmfx commented Jul 15, 2022

I have the same problem

import toga
from toga.style.pack import COLUMN, LEFT, RIGHT, ROW, Pack

from helloworld.web_tools import get_server_msg,set_stop_msg
from travertino.constants import CENTER, BLUE


class HelloWorld(toga.App):

    def startup(self):
        main_box = toga.Box(style=Pack(padding=5, direction=COLUMN, background_color='#000000'))

        server_name_tv = toga.Label('当前服务:未开启',
                                         style=Pack(text_align=CENTER, height=30, background_color=BLUE))
        main_box.add(server_name_tv)
        self.main_window = toga.MainWindow(title='server_name_tv')
        self.main_window.content = main_box
        self.main_window.show()


def main():
    return HelloWorld()

@freakboy3742 freakboy3742 changed the title toga.Label() text_align não funciona no android toga.Label() text_align problem on Android Jul 15, 2022
@freakboy3742 freakboy3742 added up-for-grabs android The issue relates to Android mobile support. labels Jul 15, 2022
@freakboy3742
Copy link
Member

Thanks for the reproduction case - I can confirm I'm seeing this problem; my guess is that the label is being centered - but the box in which it is centred is the same width as the label, so centering has no effect. However, that's a bug, as the main box should be allocated the full width of the screen.

@freakboy3742
Copy link
Member

This has been addressed as part of #1799.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android The issue relates to Android mobile support. bug A crash or error in behavior.
Projects
None yet
Development

No branches or pull requests

3 participants