Re: customized alignment in gtk text view



You likely have an issue with variable font sizing. Use gtk_text_view_set_monospace() to use a fixed width font.

Also, this mailing list is for development of gtk. Use the gtk-app-devel list in the future.

On June 1, 2017 6:10:37 AM PDT, Karan Ahuja <karan26 ahuja gmail com> wrote:
Hi

I wish to display 3 lines in gtk textview as below

software-lumapix                                  +2000
software-adigiprints                              +3000
software-yst                                          +3000

on command line i see the strings as above as required.
but when i copy the output from commandline to gtk text view or gmail here or use
set_text method on the text buffer - the alignment is lost and i see this

software-lumapix                                  +2000
software-adigiprints                              +3000
software-yst                                      +3000

my simple code is as below in python gtk+

str1 = '{message: <{width}}'.format(message="software-lumapix", width=50)
str1 = str1+'+2000'
print str1
str2 = '{message: <{width}}'.format(message="software-adigiprints", width=50)
str2 = str2+'+3000'
print str2
str3 = '{message: <{width}}'.format(message="software-yst", width=50)
str3 = str3+'+3000'
print str3
self.view.get_buffer().set_text(str1+'\n'+str2+'\n'+str3)


Please guide - how can i align the numbers right aligned.

cheers,
karan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]