In gtk, how to centralize text in a textview vertically?

If I just create a standard TextView with Justification set to Center , it looks something like this:

Center-Justified TextView

If I also want to center the text both vertically and horizontally, how can I do this?

+6
c # gtk gtk #
source share
3 answers

TextViews are usually designed for large amounts of text that the user can edit. Thus, it can become too large and must scroll, therefore, difficulties with vertical centering.

If you use it only to display a message that you do not need to edit, you can try Gtk.Label instead, which you can center vertically.

+4
source share

Perhaps you can succumb to this alignment by dynamically updating pixels-above-lines based on the size of the textview control and the size of the text displayed in it.

+3
source share

You tried to use:

 GTK_WRAP_CHAR 

which can wrap text in a β€œplace where the cursor can appear”, as shown here: http://developer.gnome.org/gtk/2.24/GtkTextView.html#gtk-text-view-set-wrap-mode (click on him a little)

This can be useful with

 pixels-above-lines 
0
source share

All Articles