當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.LIST_AUTOSIZE屬性代碼示例

本文整理匯總了Python中wx.LIST_AUTOSIZE屬性的典型用法代碼示例。如果您正苦於以下問題:Python wx.LIST_AUTOSIZE屬性的具體用法?Python wx.LIST_AUTOSIZE怎麽用?Python wx.LIST_AUTOSIZE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在wx的用法示例。


在下文中一共展示了wx.LIST_AUTOSIZE屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import LIST_AUTOSIZE [as 別名]
def __init__(self, parent):
        wx.ListCtrl.__init__(self, parent, -1,
            style = wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_SINGLE_SEL |
                    wx.LC_HRULES | wx.LC_VRULES)

        self.sex = ["Female", "Male"]

        self.InsertColumn(0, "Name")
        self.InsertColumn(1, "Type")
        self.InsertColumn(2, "Sex")
        self.SetColumnWidth(0, 120)
        self.SetColumnWidth(1, 120)

        # we can't use wx.LIST_AUTOSIZE since this is a virtual control,
        # so calculate the size ourselves since we know the longest string
        # possible.
        w = util.getTextExtent(self.GetFont(), "Female")[0] + 15
        self.SetColumnWidth(2, w)

        util.setWH(self, w = 120*2 + w + 25) 
開發者ID:trelby,項目名稱:trelby,代碼行數:22,代碼來源:namesdlg.py

示例2: set_default_widths

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import LIST_AUTOSIZE [as 別名]
def set_default_widths(self):
        # must be called before *any* data is put into the control.
        sample_data = {}
        for name in self.column_order:
            sample_data[name] = self.columns[name].sample_data
        sample_row = BTListRow(None, sample_data)

        self.InsertRow(-1, sample_row)
        for name in self.column_order:
            column = self.columns[name]
            if name in self.enabled_columns:
                self.SetColumnWidth(column.GetColumn(), wx.LIST_AUTOSIZE)
                column.width = self.GetColumnWidth(column.GetColumn())
            dc = wx.ClientDC(self)
            header_width = dc.GetTextExtent(column.GetText())[0]
            header_width += 4 # arbitrary allowance for header decorations
            column.width = max(column.width, header_width)
            if name in self.enabled_columns:
                self.SetColumnWidth(column.GetColumn(), column.width)
        self.default_rect = self.GetItemRect(0)
        self.DeleteRow(-1) 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:23,代碼來源:ListCtrl.py

示例3: CreateColumns

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import LIST_AUTOSIZE [as 別名]
def CreateColumns( self ):
        """Create/recreate our column definitions from current self.columns"""
        self.SetItemCount(0)
        # clear any current columns...
        for i in range( self.GetColumnCount())[::-1]:
            self.DeleteColumn( i )
        # now create
        for i, column in enumerate(self.columns):
            column.index = i
            self.InsertColumn(i, column.name)
            if not windows or column.targetWidth is None:
                self.SetColumnWidth(i, wx.LIST_AUTOSIZE)
            else:
                self.SetColumnWidth(i, column.targetWidth) 
開發者ID:lrq3000,項目名稱:pyFileFixity,代碼行數:16,代碼來源:listviews.py

示例4: AddColumn

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import LIST_AUTOSIZE [as 別名]
def AddColumn(self, text, size=-1, format=wx.LIST_FORMAT_LEFT):
    if size in [None, -1, wx.LIST_AUTOSIZE]:
#      size=wx.LIST_AUTOSIZE
      size=self.GetClientSize().GetWidth();
      for i in range(self.GetColumnCount()):
        size -= self.GetColumnWidth(i)
    elif size > 0:
      size=self.convert(size) + self.MARGIN
      if not self.GetColumnCount():
        size += self.ICONWITDH
    return self.InsertColumn(self.GetColumnCount(), text, format, size); 
開發者ID:andreas-p,項目名稱:admin4,代碼行數:13,代碼來源:ctl_adm.py

示例5: AutoSizeColumns

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import LIST_AUTOSIZE [as 別名]
def AutoSizeColumns(self):
        """
        Resize our auto sizing columns to match the data
        """
        for (iCol, col) in enumerate(self.columns):
            if col.width == wx.LIST_AUTOSIZE:
                self.SetColumnWidth(iCol, wx.LIST_AUTOSIZE)

                # The new width must be within our minimum and maximum
                colWidth = self.GetColumnWidth(iCol)
                boundedWidth = col.CalcBoundedWidth(colWidth)
                if colWidth != boundedWidth:
                    self.SetColumnWidth(iCol, boundedWidth)

        self._ResizeSpaceFillingColumns() 
開發者ID:JackonYang,項目名稱:bookhub,代碼行數:17,代碼來源:ObjectListView.py


注:本文中的wx.LIST_AUTOSIZE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。