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


Python ImageButton.capture方法代码示例

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


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

示例1: _init_tabs

# 需要导入模块: from horizons.gui.widgets.imagebutton import ImageButton [as 别名]
# 或者: from horizons.gui.widgets.imagebutton.ImageButton import capture [as 别名]
	def _init_tabs(self):
		"""Add enough tabbuttons for all widgets."""
		def on_tab_removal(tabwidget):
			# called when a tab is being removed (via weakref since tabs shouldn't have references to the parent tabwidget)
			# If one tab is removed, the whole tabwidget will die..
			# This is easy usually the desired behavior.
			if tabwidget():
				tabwidget().on_remove()

		# Load buttons
		for index, tab in enumerate(self._tabs):
			# don't add a reference to the
			tab.add_remove_listener(Callback(on_tab_removal, weakref.ref(self)))
			container = Container(name="container_%s" % index)
			background = Icon(name="bg_%s" % index)
			button = ImageButton(name=str(index), size=(50, 50))
			if self.current_tab is tab:
				background.image = tab.button_background_image_active
				button.path = tab.path_active
			else:
				background.image = tab.button_background_image
				button.path = tab.path
			button.capture(Callback(self._show_tab, index))
			if hasattr(tab, 'helptext') and tab.helptext is not None:
				button.helptext = tab.helptext
			container.size = background.size
			container.addChild(background)
			container.addChild(button)
			self.content.addChild(container)
		self.widget.size = (50, 55*len(self._tabs))
		self.widget.adaptLayout()

		self._apply_layout_hack()
开发者ID:STEVEOO6,项目名称:unknown-horizons,代码行数:35,代码来源:tabwidget.py

示例2: _create_build_buttons

# 需要导入模块: from horizons.gui.widgets.imagebutton import ImageButton [as 别名]
# 或者: from horizons.gui.widgets.imagebutton.ImageButton import capture [as 别名]
	def _create_build_buttons(self, building_id, container):
		# {{mode}} in double braces because it is replaced as a second step
		building_type = Entities.buildings[building_id]
		build_button = ImageButton(name="build{id}".format(id=building_id), helptext=building_type.get_tooltip())
		build_button.path = "icons/buildmenu/{id:03d}".format(id=building_id)
		build_button.capture(Callback(self.build_related, building_id))
		return build_button
开发者ID:BenjaminHarper,项目名称:unknown-horizons,代码行数:9,代码来源:buildrelatedtab.py

示例3: __init__

# 需要导入模块: from horizons.gui.widgets.imagebutton import ImageButton [as 别名]
# 或者: from horizons.gui.widgets.imagebutton.ImageButton import capture [as 别名]
	def __init__(self):
		self.page_widgets = {}
		self.widget = load_uh_widget(self.widget_xml, center_widget=True)

		# Lists holding pickbelt ImageButtons, placed to the left/right of the book
		self.buttons = {'left': [], 'right': []}

		for i, (name, text) in enumerate(self.sections):
			self.page_widgets[i] = self.widget.findChild(name=name)

		# Create the required pickbelts
		for i, (name, text) in enumerate(self.sections):
			for side in self.buttons:
				pickbelt = ImageButton(text=text)
				pickbelt.name = name + '_' + side
				pickbelt.path = 'images/background/pickbelt_%s' % side
				pickbelt.font = "pickbelt"

				pickbelt.capture(Callback(self.update_view, i), event_name="mouseClicked")

				start_x, start_y = self.pickbelt_start_pos
				pickbelt.position = (start_x + 5*i, start_y + 70*i)

				container = self.widget.findChild(name="%s_pickbelts" % side)
				container.addChild(pickbelt)
				self.buttons[side].append(pickbelt)

		self.widget.show() # Hack to initially setup the pickbelts properly
		self.update_view()
		self.widget.hide() # Hack to initially setup the pickbelts properly
开发者ID:JamesOravec,项目名称:unknown-horizons,代码行数:32,代码来源:pickbeltwidget.py

示例4: _create_build_buttons

# 需要导入模块: from horizons.gui.widgets.imagebutton import ImageButton [as 别名]
# 或者: from horizons.gui.widgets.imagebutton.ImageButton import capture [as 别名]
	def _create_build_buttons(self, building_id, container):
		# {{mode}} in double braces because it is replaced as a second step
		helptext = self.instance.session.db.get_building_tooltip(building_id)
		build_button = ImageButton(name="build{id}".format(id=building_id), helptext=helptext)
		build_button.path = "icons/buildmenu/{id:03d}".format(id=building_id)
		build_button.capture(Callback(self.build_related, building_id))
		return build_button
开发者ID:Daenor,项目名称:unknown-horizons,代码行数:9,代码来源:buildrelatedtab.py


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