我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用wx.FLEX_GROWMODE_SPECIFIED。
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Background Task", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.gauge = wx.Gauge(self, wx.ID_ANY, 10 ** 3, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL) self.gauge.SetValue(0) gb_sizer.Add(self.gauge, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.button = wx.Button(self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.button, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) gb_sizer.AddGrowableCol(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) # Connect Events self.button.Bind(wx.EVT_BUTTON, self.on_run) self.model = WatchableDict() self.model["complete"] = 0 pywatch.wx.ValueWatcher(self.gauge, self.model, "complete") # Virtual event handlers, overide them in your derived class
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Background Logging", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) list_boxChoices = [] self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.button = wx.Button(self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.button, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableRow(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) # Connect Events self.button.Bind(wx.EVT_BUTTON, self.on_run) self.model = WatchableDict() self.model["logs"] = [] pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "logs") # Virtual event handlers, overide them in your derived class
def _init_sizers(self): # generated method, don't edit self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0) self.flexGridSizer1.SetMinSize(wx.Size(200, 121)) self.flexGridSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) self.SetSizer(self.flexGridSizer1)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Selection Frame", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.model = WatchableDict() self.model["selection"] = 1 self.model["list"] = [u"One", u"Two", u"Three"] self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) choices = [] self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, choices, 0) gb_sizer.Add(self.combo_box, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list") pywatch.wx.SelectionChanger(self.combo_box, self.model, "selection") self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0) self.choice.SetSelection(0) gb_sizer.Add(self.choice, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list") pywatch.wx.SelectionChanger(self.choice, self.model, "selection") self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(2, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.SelectionChanger(self.list_box, self.model, "selection") self.radio_box = wx.RadioBox(self, wx.ID_ANY, u"Radio Box", wx.DefaultPosition, wx.DefaultSize, [u"One", u"Two", u"Three"], 1, wx.RA_SPECIFY_COLS) self.radio_box.SetSelection(0) gb_sizer.Add(self.radio_box, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 5) pywatch.wx.SelectionChanger(self.radio_box, self.model, "selection") gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableRow(2) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH)
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"List Editor", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) list_boxChoices = [] self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) self.add_button = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.add_button, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.remove_button = wx.Button(self, wx.ID_ANY, u"Remove", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.remove_button, wx.GBPosition(1, 1), wx.GBSpan(1, 1), wx.EXPAND, 0) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.text_ctrl, wx.GBPosition(2, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableCol(1) gb_sizer.AddGrowableRow(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) self.add_button.Bind(wx.EVT_BUTTON, self.on_add) self.remove_button.Bind(wx.EVT_BUTTON, self.on_remove) self.model = WatchableDict() self.model["list"] = ["one", "two", "three", "four"] self.model["selection"] = 0 pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.SelectionChanger(self.list_box, self.model, "selection") def getter(): return self.model["list"][self.model["selection"]] def setter(value): self.model["list"][self.model["selection"]] = value pywatch.wx.ValueChanger(self.text_ctrl, self.model, ("list", "selection", setter, getter))
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"List Frame", pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) sizer = wx.BoxSizer(wx.VERTICAL) gb_sizer = wx.GridBagSizer(5, 5) gb_sizer.SetFlexibleDirection(wx.BOTH) gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) list_boxChoices = [] self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0) gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) combo_boxChoices = [] self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, combo_boxChoices, 0) gb_sizer.Add(self.combo_box, wx.GBPosition(1, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) choiceChoices = [] self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choiceChoices, 0) self.choice.SetSelection(0) gb_sizer.Add(self.choice, wx.GBPosition(2, 0), wx.GBSpan(1, 2), wx.EXPAND, 0) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER) gb_sizer.Add(self.text_ctrl, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 0) self.button = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0) gb_sizer.Add(self.button, wx.GBPosition(3, 1), wx.GBSpan(1, 1), wx.ALL, 0) gb_sizer.AddGrowableCol(0) gb_sizer.AddGrowableRow(0) sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(sizer) self.Layout() self.Centre(wx.BOTH) # Connect Events self.button.Bind(wx.EVT_BUTTON, self.on_add) self.text_ctrl.Bind(wx.EVT_TEXT_ENTER, self.on_add) self.model = WatchableDict() self.model["list"] = [] self.model["text"] = "" pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text") pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list") pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list") pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list") # Virtual event handlers, overide them in your derived class