How to set grid default col alignment.

Hi,
I starting to play with grids and my problem (so far)
is to find a way of setting a default alignment for the colums,
I try “wXPython in Action” pag. 443~444, also the wiki
but without results.

Thank in advance for your help.

Jorge escribió:

Hi,
I starting to play with grids and my problem (so far)
is to find a way of setting a default alignment for the colums,
I try "wXPython in Action" pag. 443~444, also the wiki
but without results.

Thank in advance for your help.

Uhm... You'll have to set the alignment cell by cell with the SetCellAlignment(row, col, horiz, vert) method.

Take a look at this little example:

self.CreateGrid(5, 3)
col_h_alignment = (wx.ALIGN_LEFT, wx.ALIGN_CENTRE, wx.ALIGN_RIGHT)
col_v_alignment = (wx.ALIGN_TOP, wx.ALIGN_CENTRE, wx.ALIGN_BOTTOM)

for row in range(5):
     for col in range(3):
         self.SetCellValue(row, col, "Column %i" % col)
         self.SetCellAlignment(row, col, col_h_alignment[col], col_h_alignment[col])

The complete version is here: Marcelo Fernandez - Pastebin.com

Regards,
Marcelo

···

--
Marcelo F. Fernández
Buenos Aires, Argentina
Licenciado en Sistemas - CCNA

E-Mail: fernandezm22@yahoo.com.ar
Jabber ID: fernandezm22@jabber.org
Public Key ID: 5C990A6C 111C3661
Blog: http://marcelosoft.blogspot.com

Jorge wrote:

Hi,
I starting to play with grids and my problem (so far)
is to find a way of setting a default alignment for the colums,
I try "wXPython in Action" pag. 443~444, also the wiki
but without results.

Thank in advance for your help.

Create a GridCellAttr object, set the alignment flags on the attr object and then pass the attr to SetColAttr.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thank you.

···

On Tue, Mar 17, 2009 at 5:01 AM, Robin Dunn robin@alldunn.com wrote:

Jorge wrote:

Hi,

I starting to play with grids and my problem (so far)

is to find a way of setting a default alignment for the colums,

I try “wXPython in Action” pag. 443~444, also the wiki

but without results.

Thank in advance for your help.

Create a GridCellAttr object, set the alignment flags on the attr object and then pass the attr to SetColAttr.

Robin Dunn

Software Craftsman

http://wxPython.org Java give you jitters? Relax with wxPython!


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

To set the default grid cell alignment after creating the grid
enter the following line:

grid.SetDefaultCellAlignment(WX.CENTRE, wx.CENTRE)

My previous post left out the second 'wx.'

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/How-to-set-grid-default-col-alignment-tp2372996p4336562.html
Sent from the wxPython-users mailing list archive at Nabble.com.