0

Another wxgrid question: After you create your grid, I would like to create the form in the attached image enter image description here

I know I can set the background color via grid.SetCellBackgroundColour(2, 2, "light blue") but how can i gold the lines just like the example

canbaran
  • 465
  • 1
  • 4
  • 7

1 Answers1

0

You can probably do that with a custom Grid renderer, which you can find in wx.lib.mixins.gridlabelrenderer. The wxPython demo has an example.

Another way to do this would be to use the XLSGrid widget, which is a custom widget in wxPython. There's also a demo for that one as well. I suspect it is using the wx.grid.Grid under the covers, so you might want to take a look at its source to see how it works.

Mike Driscoll
  • 32,629
  • 8
  • 45
  • 88
  • can you point me to an exact example for my application? I can see there is an example that imports that module but it s not clear how I can use that module to do what i want. The following code: g.SetColLabelRenderer(col+0, MyColLabelRenderer('#e0ffe0')) changes the color, but how do I make the edges bolder – canbaran Dec 10 '13 at 16:47
  • for instance the link: http://wxpython.org/Phoenix/docs/html/lib.mixins.gridlabelrenderer.GridLabelRenderer.html shows there is a drawborder function. Does that create the affect i want? I'd be happier if there is a little more guidance. – canbaran Dec 10 '13 at 16:50
  • There are examples in the source. It looks rather complicated, but see "xlsgrid.py", which is in "C:\Python27\Lib\site-packages\wx-2.9.4-msw\wx\lib\agw" on my Windows box. There is a method called DrawBorder in there (line 1339) that shows how to do it. – Mike Driscoll Dec 10 '13 at 19:11
  • decided to try to create the affect via a different way. what you recommended seems to be incompatible with mac. thanks though – canbaran Dec 11 '13 at 19:11