当前位置: 首页>>代码示例>>Python>>正文


Python wx.GridBagSizer方法代码示例

本文整理汇总了Python中wx.GridBagSizer方法的典型用法代码示例。如果您正苦于以下问题:Python wx.GridBagSizer方法的具体用法?Python wx.GridBagSizer怎么用?Python wx.GridBagSizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.GridBagSizer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _build_playlist_sizer

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def _build_playlist_sizer(self):
        playlist_box_sizer = wx.StaticBoxSizer(self.playlist_box, wx.VERTICAL)
        playlist_box_sizer.AddSpacer((-1, 10))

        border = wx.GridBagSizer(5, 40)

        border.Add(self.playlist_start_label, (0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        border.Add(self.playlist_start_spinctrl, (0, 1))

        border.Add(self.playlist_stop_label, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        border.Add(self.playlist_stop_spinctrl, (1, 1))

        border.Add(self.playlist_max_label, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        border.Add(self.playlist_max_spinctrl, (2, 1))

        playlist_box_sizer.Add(border, flag=wx.ALIGN_CENTER)

        return playlist_box_sizer 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:20,代码来源:optionsframe.py

示例2: _build_filesize_sizer

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def _build_filesize_sizer(self):
        filesize_box_sizer = wx.StaticBoxSizer(self.filesize_box, wx.VERTICAL)

        border = wx.GridBagSizer(5, 20)

        border.Add(self.filesize_max_label, (0, 0), (1, 2), wx.ALIGN_CENTER_HORIZONTAL)

        border.Add(self.filesize_max_spinctrl, (1, 0))
        border.Add(self.filesize_max_sizeunit_combobox, (1, 1))

        border.Add(self.filesize_min_label, (2, 0), (1, 2), wx.ALIGN_CENTER_HORIZONTAL)

        border.Add(self.filesize_min_spinctrl, (3, 0))
        border.Add(self.filesize_min_sizeunit_combobox, (3, 1))

        filesize_box_sizer.Add(border, flag=wx.ALIGN_CENTER)

        return filesize_box_sizer 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:20,代码来源:optionsframe.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def __init__(self, parent, gui_size):
        h = gui_size[0]
        w = gui_size[1]
        wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER, size=(h, w))

        ##         design the panel
        sizer = wx.GridBagSizer(10, 7)
        # Add image of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(dlc))
        sizer.Add(icon, pos=(0, 0), span=(0, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)
        line = wx.StaticLine(self)
        sizer.Add(line, pos=(1, 0), span=(1, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)

        # if editing this text make sure you add the '\n' to get the new line. The sizer is unable to format lines correctly.
        description = "DeepLabCut™ is an open source tool for markerless\npose estimation of user-defined body parts with deep learning.\nA. and M.W. Mathis Labs | http://www.deeplabcut.org\n \nWelcome to the DeepLabCut Project Manager GUI!\nTo get started, please click on the 'Manage Project'\n tab to create or load an existing project. \n "

        self.proj_name = wx.StaticText(self, label=description, style=wx.ALIGN_CENTRE)
        sizer.Add(self.proj_name, pos=(2, 3), border=10)
        sizer.AddGrowableCol(2)
        self.SetSizer(sizer)
        sizer.Fit(self) 
开发者ID:DeepLabCut,项目名称:DeepLabCut,代码行数:23,代码来源:welcome.py

示例4: child_widget_created

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def child_widget_created(self, child, level):
        "called from finish_widget_creation() to add widget to sizer widget"
        index = child.index
        if self._IS_GRIDBAG:
            # GridBagSizer: add at (row, col) position
            self.widget.Add( child.widget, index, child.span, child.flag, child.border, destroy=True )
        else:
            # no GridBagSizer: add or insert at index position
            if index+self.widget._BTN_OFFSET>=len(self.widget.GetChildren()):
                self.widget.Add( child.widget, child.proportion, child.flag, child.border )
            else:
                self.widget.Insert(index+self.widget._BTN_OFFSET, child.widget, child.proportion, child.flag, child.border)

        if child.check_prop("size"):
            # size has been set in set_size, so we can just use GetSize here
            self.set_item_best_size(child, size=child.widget.GetSize())
        if self.widget:
            self.window.widget.Layout() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:20,代码来源:edit_sizers.py

示例5: AddGrid

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def AddGrid(self, grid, vgap=6, hgap=5):
        columns = self.maxRowNum
        sizer = wx.GridBagSizer(vgap, hgap)
        sizer.SetFlexibleDirection(wx.HORIZONTAL)
        rowFlagsGet = self.rowFlags.get
        colFlagsGet = self.colFlags.get
        for rowNum, (row, kwargs) in enumerate(grid):
            if kwargs.get("growable", False):
                sizer.AddGrowableRow(rowNum)
            for colNum, ctrl in enumerate(row):
                if ctrl is None:
                    ctrl = (1, 1)
                elif type(ctrl) in types.StringTypes:
                    ctrl = wx.StaticText(self, -1, ctrl)

                flags = rowFlagsGet(rowNum, 0) | colFlagsGet(colNum, 0)
                flags |= (wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
                sizer.Add(ctrl, (rowNum, colNum), (1, 1), flags)

            if colNum < columns - 1:
                sizer.SetItemSpan(ctrl, (1, columns - colNum + 1))
        self.sizer.Add(sizer, 1, wx.EXPAND) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:24,代码来源:ConfigPanel.py

示例6: layout_init

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def layout_init(self):
        """Create the sizers for this frame and set up the external text.

        Return the lowest row that is available.
        """
        self.frame_sizer = wx.BoxSizer(wx.VERTICAL)
        self.frame_sizer.Add((20, 10), 0, wx.EXPAND, 0) # Controls top window size
        self.inner_sizer = wx.GridBagSizer(10, 5) # Controls inner window height, width
        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
        row = 0
        # if self.is_external_miner:
            # self.inner_sizer.Add(self.external_lbl, (row, 0), flag=LBL_STYLE)
            # self.inner_sizer.Add(self.txt_external, (row, 1), span=(1, 3), flag=wx.EXPAND)
            # row += 1
        return row 
开发者ID:theRealTacoTime,项目名称:poclbm,代码行数:17,代码来源:guiminer.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def __init__(self,parent):
        wx.Panel.__init__(self,parent)
        #self.save = wx.Button(self,label="Save")
        #self.close = wx.Button(self,label="Close")
        self.close = wx.Button(self,wx.ID_CLOSE)
        self.close.Bind(wx.EVT_BUTTON, self.OnClose)


        self.sizer = wx.GridBagSizer(1,2)
        self.sizer.Add(self.close,(1,1))
        #self.sizer.Add(self.close,(1,2,)) 
开发者ID:ruanxiang,项目名称:mr_saliency,代码行数:13,代码来源:live_demo.py

示例8: set_overlap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def set_overlap(self, overlapped=True, add_to_sizer=True):
        # interface from GridBagSizer; so self.parent is a sizer
        if overlapped==self.overlapped: return
        self.overlapped = overlapped
        sizer = self.parent
        if overlapped:
            if self.widget:
                self.parent.destroying_child_widget(self, self.index)
                self.destroy_widget(0)
        else:
            if sizer.widget and not self.widget:
                self.create_widget()
                if add_to_sizer:
                    sizer.widget.Add(self.widget, self.index, self.span, wx.EXPAND, self.border)
        common.app_tree.refresh(self)  # XXX indicate overlapped slots 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:17,代码来源:edit_sizers.py

示例9: GetItem

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def GetItem(self, widget):
        if hasattr(self._grid, "FindItem"):
            return self._grid.FindItem(widget)  # GridBagSizer
        return self._grid.GetItem(widget) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:6,代码来源:edit_sizers.py

示例10: _create

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def _create(self, rows, cols, vgap, hgap):
        self._grid = wx.GridBagSizer(vgap, hgap) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:4,代码来源:edit_sizers.py

示例11: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def __init__(self, bgapp, icons):
        self.bgapp = bgapp
        self.user_profile = self.bgapp.user_profile
        wx.Dialog.__init__(self, None, -1, self.bgapp.appname + ' ' + self.bgapp.utility.lang.get('user_profile'), size=(400, 200), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.SetIcons(icons)
        grid = wx.GridBagSizer(hgap=5, vgap=8)
        grid.AddGrowableCol(1, 1)
        row = -1
        row += 1
        label = wx.StaticText(self, wx.ID_ANY, self.bgapp.utility.lang.get('gender'))
        self.ctrl_gender = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY)
        for id, name in self.user_profile.get_genders().iteritems():
            name = self.bgapp.utility.lang.get(name)
            idx = self.ctrl_gender.Append(name, id)
            if id == self.user_profile.get_gender_id():
                self.ctrl_gender.Select(idx)

        grid.Add(label, pos=(row, 0))
        grid.Add(self.ctrl_gender, pos=(row, 1))
        row += 1
        label = wx.StaticText(self, wx.ID_ANY, self.bgapp.utility.lang.get('age'))
        self.ctrl_age = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY)
        ages = []
        for id, name in self.user_profile.get_ages().iteritems():
            if name.startswith('age_less'):
                priority = ''
            elif name.startswith('age_more'):
                priority = 'z'
            else:
                priority = name
            ages.append((priority, {'id': id,
              'name': name}))

        for priority, age in sorted(ages):
            id = age['id']
            name = age['name']
            name = self.bgapp.utility.lang.get(name)
            idx = self.ctrl_age.Append(name, id)
            if id == self.user_profile.get_age_id():
                self.ctrl_age.Select(idx)

        grid.Add(label, pos=(row, 0))
        grid.Add(self.ctrl_age, pos=(row, 1))
        btn_ok = wx.Button(self, wx.ID_OK, self.bgapp.utility.lang.get('ok'))
        btn_cancel = wx.Button(self, wx.ID_CANCEL, self.bgapp.utility.lang.get('cancel'))
        buttonbox = wx.BoxSizer(wx.HORIZONTAL)
        buttonbox.Add(btn_ok, 0, wx.ALL, 5)
        buttonbox.Add(btn_cancel, 0, wx.ALL, 5)
        mainbox = wx.BoxSizer(wx.VERTICAL)
        mainbox.Add(grid, 1, wx.EXPAND | wx.ALL, border=5)
        mainbox.Add(buttonbox, 0)
        self.SetSizerAndFit(mainbox)
        self.Show()
        self.Bind(wx.EVT_BUTTON, self.OnOK, btn_ok) 
开发者ID:alesnav,项目名称:p2ptv-pi,代码行数:56,代码来源:systray.py

示例12: _set_layout

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def _set_layout(self):
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        vertical_sizer = wx.BoxSizer(wx.VERTICAL)

        # Set up retries box
        retries_sizer = wx.BoxSizer(wx.HORIZONTAL)
        retries_sizer.Add(self.retries_label, flag=wx.ALIGN_CENTER_VERTICAL)
        retries_sizer.AddSpacer((20, -1))
        retries_sizer.Add(self.retries_spinctrl)
        vertical_sizer.Add(retries_sizer, flag=wx.ALIGN_RIGHT | wx.TOP | wx.RIGHT, border=5)

        # Set up authentication box
        vertical_sizer.Add(self.auth_label, flag=wx.TOP, border=10)
        auth_sizer = wx.GridBagSizer(5, -1)

        auth_sizer.Add(self.username_label, (0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        auth_sizer.Add(self.username_textctrl, (0, 2))

        auth_sizer.Add(self.password_label, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        auth_sizer.Add(self.password_textctrl, (1, 2))

        auth_sizer.Add(self.video_pass_label, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        auth_sizer.Add(self.video_pass_textctrl, (2, 2))

        auth_sizer.AddGrowableCol(1)
        vertical_sizer.Add(auth_sizer, flag=wx.EXPAND | wx.ALL, border=5)

        # Set up network box
        vertical_sizer.Add(self.network_label, flag=wx.TOP, border=10)
        network_sizer = wx.GridBagSizer(5, -1)

        network_sizer.Add(self.proxy_label, (0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        network_sizer.Add(self.proxy_textctrl, (0, 2))

        network_sizer.Add(self.useragent_label, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        network_sizer.Add(self.useragent_textctrl, (1, 2))

        network_sizer.Add(self.referer_label, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        network_sizer.Add(self.referer_textctrl, (2, 2))

        network_sizer.AddGrowableCol(1)
        vertical_sizer.Add(network_sizer, flag=wx.EXPAND | wx.ALL, border=5)

        # Set up logging box
        vertical_sizer.Add(self.logging_label, flag=wx.TOP, border=10)

        logging_sizer = wx.BoxSizer(wx.HORIZONTAL)
        logging_sizer.Add(self.enable_log_checkbox)
        logging_sizer.AddSpacer((-1, -1), 1)
        logging_sizer.Add(self.view_log_button)
        logging_sizer.AddSpacer((5, -1))
        logging_sizer.Add(self.clear_log_button)

        vertical_sizer.Add(logging_sizer, flag=wx.EXPAND | wx.ALL, border=5)

        main_sizer.Add(vertical_sizer, 1, wx.EXPAND | wx.ALL, border=5)
        self.SetSizer(main_sizer) 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:59,代码来源:optionsframe.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def __init__(self, parent, fontsize, maximum, title, formatting_string, vertical=False):
        wx.Frame.__init__(self, parent, style=wx.NO_BORDER)

        if isinstance(maximum, list):
            self.list_maximum = maximum
            self.list_title = title
            self.list_formatting_string = formatting_string
        else:
            self.list_maximum = [maximum]
            self.list_title = [title]
            self.list_formatting_string = [formatting_string]

        self.labels = []
        self.titles = []
        self.gauges = []
        self.sizer = wx.GridBagSizer(5, 5)
        for i in range(len(self.list_maximum)):
            if vertical:
                if title:
                    self.titles.append(wx.StaticText(self, label=self.list_title[i] + ':', style=wx.ALIGN_LEFT))
                self.labels.append(wx.StaticText(self, style=wx.ALIGN_RIGHT))
                self.gauges.append(wx.Gauge(self, range=self.list_maximum[i]))
            else:
                if title:
                    self.titles.append(wx.StaticText(self, label=self.list_title[i], style=wx.ALIGN_CENTER))
                self.labels.append(wx.StaticText(self, style=wx.ALIGN_CENTRE_HORIZONTAL))
                self.gauges.append(wx.Gauge(self, range=self.list_maximum[i], style=wx.GA_VERTICAL))
            font = wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.BOLD)
            self.labels[i].SetFont(font)
            if title:
                self.titles[i].SetFont(font)
            if vertical:
                if title:
                    self.sizer.Add(self.titles[i], pos=(i, 0), flag=wx.ALL|wx.ALIGN_BOTTOM)
                self.sizer.Add(self.gauges[i], pos=(i, 1), flag=wx.ALL|wx.EXPAND)
                self.sizer.Add(self.labels[i], pos=(i, 2), flag=wx.ALL|wx.ALIGN_BOTTOM)
            else:
                if title:
                    self.sizer.Add(self.titles[i], pos=(0, i), flag=wx.ALL|wx.ALIGN_CENTER)
                extra = wx.BoxSizer(wx.HORIZONTAL)
                extra.AddStretchSpacer()
                extra.Add(self.gauges[i], flag=wx.EXPAND)
                extra.AddStretchSpacer()
                self.sizer.Add(extra, pos=(1, i), flag=wx.ALL|wx.EXPAND)
                self.sizer.Add(self.labels[i], pos=(2, i), flag=wx.ALL|wx.ALIGN_CENTER)
                self.sizer.AddGrowableCol(i, 0)
        if vertical:
            self.sizer.AddGrowableCol(1, 1)
        else:
            self.sizer.AddGrowableRow(1)
        self.SetSizer(self.sizer)
        self.sizer.Fit(self) 
开发者ID:tangible-landscape,项目名称:grass-tangible-landscape,代码行数:54,代码来源:activities_dashboard.py

示例14: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def __init__(
        self,
        parent,
        id = -1,
        value = None,
        min = None,
        max = None,
        pos = wx.DefaultPosition,
        size = wx.DefaultSize,
        style = 0,
        valueLabel = None,
        minLabel = None,
        maxLabel = None,
        levelCallback = None
    ):
        if minLabel is None:
            minLabel = str(min)
        if maxLabel is None:
            maxLabel = str(max)
        if valueLabel is None:
            valueLabel = "%(1)i"
        self.valueLabel = valueLabel
        self.levelCallback = levelCallback
        wx.Window.__init__(self, parent, id, pos, size, style)
        self.slider = wx.Slider(
            self,
            -1,
            value,
            min,
            max,
            style = style
        )
        st1 = wx.StaticText(self, -1, minLabel)
        self.valueLabelCtrl = wx.StaticText(self, -1, valueLabel)
        st2 = wx.StaticText(self, -1, maxLabel)

        sizer = wx.GridBagSizer()
        sizer.AddMany([
            (self.slider, (0, 0), (1, 3), wx.EXPAND),
            (st1, (1, 0), (1, 1), wx.ALIGN_LEFT),
            (self.valueLabelCtrl, (1, 1), (1, 1), wx.ALIGN_CENTER_HORIZONTAL),
            (st2, (1, 2), (1, 1), wx.ALIGN_RIGHT),
        ])
        sizer.AddGrowableCol(1, 1)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        sizer.Fit(self)
        self.Layout()
        self.SetMinSize(self.GetSize())
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SCROLL, self.OnScrollChanged)
        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.OnScrollChanged() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:55,代码来源:Slider.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridBagSizer [as 别名]
def __init__(
        self,
        parent,
        wxId=wx.ID_ANY,
        value=None,
        minValue=None,
        maxValue=None,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=0,
        valueLabel=None,
        minLabel=None,
        maxLabel=None,
    ):
        self.valueLabel = valueLabel
        wx.Window.__init__(self, parent, wxId, pos, size, style)
        sizer = wx.GridBagSizer()
        self.slider = wx.Slider(
            self,
            wx.ID_ANY,
            value,
            minValue,
            maxValue,
            style=style
        )
        sizer.Add(self.slider, (0, 0), (1, 3), wx.EXPAND)
        st = wx.StaticText(self, wx.ID_ANY, minLabel)
        sizer.Add(st, (1, 0), (1, 1), wx.ALIGN_LEFT)
        self.valueLabelCtrl = wx.StaticText(self, wx.ID_ANY, valueLabel)
        sizer.Add(
            self.valueLabelCtrl,
            (1, 1),
            (1, 1),
            wx.ALIGN_CENTER_HORIZONTAL
        )
        st = wx.StaticText(self, wx.ID_ANY, maxLabel)
        sizer.Add(st, (1, 2), (1, 1), wx.ALIGN_RIGHT)
        sizer.AddGrowableCol(1, 1)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        sizer.Fit(self)
        self.Layout()
        self.SetMinSize(self.GetSize())
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SCROLL, self.OnScrollChanged)
        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.OnScrollChanged() 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:49,代码来源:__init__.py


注:本文中的wx.GridBagSizer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。