Re: [PyGObject] TreeView: Empty integer field or right aligned string



Hello!

You can achieve what you want with the "xalign" property of CellRenderers

col_b = Gtk.TreeViewColumn('str',
                           Gtk.CellRendererText(xalign=1),
                           text=1)

xalign takes a value between 0 and 1.
xalign=0 -> left-justified
xalign=1 -> right-justified

Luca


2018-05-06 12:01 GMT+02:00 <c buhtz posteo jp>:

X-Post: https://stackoverflow.com/q/50194505/4865723

I want to have in a Gtk.TreeView

    - empty cells in a "int row" of a TreeView
    - or (as a workaround) a right aligned "string row"

There is a screenshot and example code in the StackOverflow question
linked in the first line of this post.

The problem is

    - When I give 'None' to a 'int row' a '0' is displayed. I would
      expect an empty cell. I want that cell to be
      absolute empty.

    - A workaround is to use strings instead of int and just display the
      numbers as strings doing str(int).
      But then the content of each cell is left aligned by default.
      I tried to modify that. But this also has no effect.

I attached the full example.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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