-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Today I had a use case to center the text in a libui-entry, e. g. gtk-entry on linux. That particular entry specifies the delay in seconds, e. g. just a number, and the user can simply change this value; e. g. a number 3 means to sleep for 3 seconds before showing the answer to an exam question or exam dataset trainer.
In gtk3 this should be possible via either:
entry = Gtk.Entry()
entry.props.xalign = 0.5 # e. g. xalign
or
set_halign
An even simpler API that seems to work is set_alignment:
https://docs.gtk.org/gtk3/method.Entry.set_alignment.html
With the parameter being a value between 0 and 1:
"The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."
(I guess the text in a gtk-entry is just a gtk-label.)
We do not seem to support something like set_alignment yet?
For gtk + linux, I assume this should be simple. I don't know about windows
and OSX.
Can we support this for all toolkits? If not can we add preliminary support for
this on Linux? Although I'd actually need it on windows the most, so I would not
mind this working on all platforms. I know nothing about windows and OSX as
platforms though. Anyone else knows how they would align text in an entry,
specifically the three main modes: left, right, and center (middle)?
Edit: I think I may be able to partially work around it by using a grid, but the
more elegant and simpler solution would be for the libui-entry to support
alignment.