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


Python Button._listboxColumn方法代码示例

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


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

示例1: layoutWidgets

# 需要导入模块: from Button import Button [as 别名]
# 或者: from Button.Button import _listboxColumn [as 别名]
	def layoutWidgets(self):
		gx, gy = self.theme.getGridParams()
		r = self.rect
		self.bar.rect = Rect(r.width - gx, 0, gx, r.height)

		self.labels = []
		rows = r.height / gy
		startRow = 0
		bIndex = 0
		lIndex = 0
		eIndex = 0
		if self.columnLabels:
			rowLabels = []
			y = 0
			x = 0
			remains = (r.width - gx) / gx
			for title, name, width, flags in self.columns:
				if len(self._buttons) <= bIndex:
					label = Button(self, action = 'onSortByColumn')
					label.subscribeAction('*', self)
					self._buttons.append(label)
				label = self._buttons[bIndex]
				bIndex += 1
				label.set(text = title, align = flags & ALIGN_MASK,
					data = name, visible = 1)
				if width == 0 or width > remains: width = remains
				label.rect = Rect(x, y, width * gx, gy)
				x += width * gx
				remains -= width
			startRow = 1
		for row in xrange(startRow, rows):
			rowLabels = []
			y = row * gy
			x = 0
			remains = (r.width - gx) / gx
			for title, name, width, flags in self.columns:
				if flags & F_EDITABLE:
					if len(self._entries) <= eIndex:
						label = Entry(self, align = ALIGN_E, action = 'onNewValue')
						label.subscribeAction('*', self)
						self._entries.append(label)
					label = self._entries[eIndex]
					eIndex += 1
					label._listboxColumn = name
					label.visible = 1
					label.redraw()
				else:
					if len(self._labels) <= lIndex:
						label = Button(self, action = 'onItemSelect', rmbAction = "onRmbItemSelect", style = "listitem", toggle = 1)
						label.subscribeAction('*', self)
						self._labels.append(label)
					label = self._labels[lIndex]
					lIndex += 1
					label.set(align = flags & ALIGN_MASK, visible = 1)
					label.redraw()
				if width == 0 or width > remains: width = remains
				label.rect = Rect(x, y, width * gx, gy)
				x += width * gx
				remains -= width
				rowLabels.append(label)
			self.labels.append(rowLabels)
		while lIndex < len(self._labels):
			self._labels[lIndex].visible = 0
			lIndex += 1
		while bIndex < len(self._buttons):
			self._buttons[bIndex].visible = 0
			bIndex += 1
		while eIndex < len(self._entries):
			self._entries[eIndex].visible = 0
			eIndex += 1

		self.bar.slider.position = 0
		self.bar.slider.min = 0
		if self.columnLabels:
			self.bar.slider.shown = rows - 1
		else:
			self.bar.slider.shown = rows

		self.itemsChanged()
开发者ID:Lukc,项目名称:ospace-lukc,代码行数:81,代码来源:Listbox.py


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