"sizer" with visible border?

What I mean is http://www.lusiya.com/ofstar/attachments/9_1120_1239856376.gif

because I am writing ab app with multi-languages support, it is not a
good idea to use a bitmap, on which the border is drawn with fixed
cell size, as the background pic.

maybe a table/cell works, but since the text in the parentheses is the
type of the control. for example, a choice is used for the bloodtype,
so we can choose A/B/O. there exists 3 problems
1. how to set the color/width/other style of the border line
2. as the blue line shows, Name/Address/Job have a border on the same
vertical line, it is hard to do this in a table( we have to merge many
cells, I don't like it)
3. how to embed combo/pic in cell? I don't find it in demo\GridCustEditor.py

thanks for yout tips or code :slight_smile:

oyster wrote:

What I mean is http://www.lusiya.com/ofstar/attachments/9_1120_1239856376.gif
  
Robin does this sort of thing with the Widget Inspection Tool, but I can't figure out how...see the following page for more info:

http://wiki.wxpython.org/Widget%20Inspection%20Tool

because I am writing ab app with multi-languages support, it is not a
good idea to use a bitmap, on which the border is drawn with fixed
cell size, as the background pic.

maybe a table/cell works, but since the text in the parentheses is the
type of the control. for example, a choice is used for the bloodtype,
so we can choose A/B/O. there exists 3 problems
1. how to set the color/width/other style of the border line
2. as the blue line shows, Name/Address/Job have a border on the same
vertical line, it is hard to do this in a table( we have to merge many
cells, I don't like it)
3. how to embed combo/pic in cell? I don't find it in demo\GridCustEditor.py
  
As for how to do the design, I would either use a group of nested BoxSizers or a FlexGridSizer. I don't think the grid widget is a good fit. You might take a look at the Sized Controls demo as well. I haven't used that method before, but I think it looks interesting.

···

thanks for yout tips or code :slight_smile:

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4013 (20090416) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

oyster wrote:

What I mean is http://www.lusiya.com/ofstar/attachments/9_1120_1239856376.gif

because I am writing ab app with multi-languages support, it is not a
good idea to use a bitmap, on which the border is drawn with fixed
cell size, as the background pic.

maybe a table/cell works, but since the text in the parentheses is the
type of the control. for example, a choice is used for the bloodtype,
so we can choose A/B/O. there exists 3 problems
1. how to set the color/width/other style of the border line
2. as the blue line shows, Name/Address/Job have a border on the same
vertical line, it is hard to do this in a table( we have to merge many
cells, I don't like it)
3. how to embed combo/pic in cell? I don't find it in demo\GridCustEditor.py

One way to do this is to embed each of your items in their own panel and give the panels a EVT_PAINT handler which draws a border around the edges of that panel, and then put those panels in the sizer.

Another (possibly better) way is to bind the EVT_PAINT handler to the parent panel that contains all the items, and it can use the items in the sizer to figure out where to draw lines. You can get all the sizer items with self.GetSizer().GetChildren().

···

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

It may be useful to have a look at the wxglade code as they
do visually indicate sizers.

Karsten

···

On Thu, Apr 16, 2009 at 10:50:04PM -0700, Robin Dunn wrote:

oyster wrote:

What I mean is http://www.lusiya.com/ofstar/attachments/9_1120_1239856376.gif

because I am writing ab app with multi-languages support, it is not a
good idea to use a bitmap, on which the border is drawn with fixed
cell size, as the background pic.

maybe a table/cell works, but since the text in the parentheses is the
type of the control. for example, a choice is used for the bloodtype,
so we can choose A/B/O. there exists 3 problems
1. how to set the color/width/other style of the border line
2. as the blue line shows, Name/Address/Job have a border on the same
vertical line, it is hard to do this in a table( we have to merge many
cells, I don't like it)
3. how to embed combo/pic in cell? I don't find it in demo\GridCustEditor.py

One way to do this is to embed each of your items in their own panel and
give the panels a EVT_PAINT handler which draws a border around the
edges of that panel, and then put those panels in the sizer.

Another (possibly better) way is to bind the EVT_PAINT handler to the
parent panel that contains all the items, and it can use the items in
the sizer to figure out where to draw lines. You can get all the sizer
items with self.GetSizer().GetChildren().

--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Robin Dunn wrote:

oyster wrote:

What I mean is http://www.lusiya.com/ofstar/attachments/9_1120_1239856376.gif

because I am writing ab app with multi-languages support, it is not a
good idea to use a bitmap, on which the border is drawn with fixed
cell size, as the background pic.

maybe a table/cell works, but since the text in the parentheses is the
type of the control. for example, a choice is used for the bloodtype,
so we can choose A/B/O. there exists 3 problems
1. how to set the color/width/other style of the border line
2. as the blue line shows, Name/Address/Job have a border on the same
vertical line, it is hard to do this in a table( we have to merge many
cells, I don't like it)
3. how to embed combo/pic in cell? I don't find it in demo\GridCustEditor.py

One way to do this is to embed each of your items in their own panel and give the panels a EVT_PAINT handler which draws a border around the edges of that panel, and then put those panels in the sizer.

Another (possibly better) way is to bind the EVT_PAINT handler to the parent panel that contains all the items, and it can use the items in the sizer to figure out where to draw lines. You can get all the sizer items with self.GetSizer().GetChildren().

You can also draw a basic borders around panels easily by passing a border style in the style parameter. For example,

panel = wx.Panel(self, style=wx.BORDER_SIMPLE)

See http://docs.wxwidgets.org/stable/wx_wxwindow.html#wxwindow for the other border styles. I don't think you can really control the color, width, etc.

Ben