thanks in advance
this is what i want:
http://www.lusiya.com/ofstar/attachments/9_1120_1240195219.gif , you
can find the layout struct as
http://www.lusiya.com/ofstar/attachments/9_1120_1240195840.gif
1. I want the upper grid to expand at x-direction, so when I resize
the whole dlg, it autofills horizontally
2.the colomns of the cell table keep their propotion when resize,
until I drag its width; the dragged width propotion keeps till another
drag
3.the upper gird is shown when this dlg is shown
but when I run the python code(at the end of my mail), what I get is
http://www.lusiya.com/ofstar/attachments/9_1120_1240195284.gif , as
you can see, the grid is not here!
So I have to resize the dlg, then I get
http://www.lusiya.com/ofstar/attachments/9_1120_1240195383.gif , that
is not what I desired, since the table in gird only takes a little
space on the x-direction. At the same time, there are too many white
space on the bottom for the grid( I want it to show several rows)
I can drag the column width to
http://www.lusiya.com/ofstar/attachments/9_1120_1240195448.gif , but
don't know how to deal with the extra space at the bottom
Any hints?
[code]
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# generated by wxGlade 0.6.3 on Mon Apr 20 09:56:44 2009
import wx
import wx.grid
# begin wxGlade: extracode
# end wxGlade
class MyDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: MyDialog.__init__
kwds["style"] =
wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME|wx.FULL_REPAINT_ON_RESIZE
wx.Dialog.__init__(self, *args, **kwds)
self.grid_1 = wx.grid.Grid(self, -1, size=(1, 1))
self.static_line_1 = wx.StaticLine(self, -1)
self.label_1 = wx.StaticText(self, -1, "Name")
self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
self.label_2 = wx.StaticText(self, -1, "Birthday")
self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
self.label_3 = wx.StaticText(self, -1, "E-mail")
self.text_ctrl_3 = wx.TextCtrl(self, -1, "")
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyDialog.__set_properties
self.SetTitle("dialog_1")
self.grid_1.CreateGrid(1, 2)
self.grid_1.SetColLabelValue(0, "Name")
self.grid_1.SetColLabelValue(1, "Birthday")
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyDialog.__do_layout
grid_sizer_1 = wx.FlexGridSizer(3, 1, 0, 0)
grid_sizer_2 = wx.FlexGridSizer(3, 2, 0, 0)
grid_sizer_1.Add(self.grid_1, 1, wx.EXPAND, 0)
grid_sizer_1.Add(self.static_line_1, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.text_ctrl_1, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.text_ctrl_2, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.label_3, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_2.Add(self.text_ctrl_3, 0, wx.EXPAND, 0)
grid_sizer_2.AddGrowableRow(0)
grid_sizer_2.AddGrowableRow(1)
grid_sizer_2.AddGrowableRow(2)
grid_sizer_2.AddGrowableCol(1)
grid_sizer_1.Add(grid_sizer_2, 1, wx.EXPAND, 0)
self.SetSizer(grid_sizer_1)
grid_sizer_1.Fit(self)
grid_sizer_1.AddGrowableRow(0)
grid_sizer_1.AddGrowableRow(2)
grid_sizer_1.AddGrowableCol(0)
self.Layout()
# end wxGlade
# end of class MyDialog
class MyApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
dialog_1 = MyDialog(None, -1, "")
self.SetTopWindow(dialog_1)
dialog_1.Show()
return 1
# end of class MyApp
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()
[/code]