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


Python Widget.on_mouse_press方法代码示例

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


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

示例1: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_press(self, x, y, button, modifiers):
		Widget.on_mouse_press(self, x, y, button, modifiers)
		
		r = self.clip_rect()
		for c in self.children:
			if r.intersect(c.bounds()).hit_test(x, y):
				c.on_mouse_press(x, y, button, modifiers)
开发者ID:Elizabwth,项目名称:pyman,代码行数:9,代码来源:container.py

示例2: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_press(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self.hit_test(x, y):
			self.elements['box'].patch = self.theme['checkbox'][('image_checked' if not self.value else 'image_unchecked')]
			self._down = True
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:pborky,项目名称:pyneuro,代码行数:10,代码来源:checkbox.py

示例3: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_press(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self.active_region.hit_test(x, y):
			self.shapes['frame'].patch = self.theme['button']['image_down']
			self._down = True
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:arokem,项目名称:Fos,代码行数:10,代码来源:button.py

示例4: on_mouse_release

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_release(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self._down:
			self.elements['frame'].patch = self.theme['button']['image_up']
			self._down = False
			if self.hit_test(x, y):
				if self.action:
					self.action(self)
				return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:pborky,项目名称:pyneuro,代码行数:13,代码来源:button.py

示例5: on_mouse_release

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_release(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self._down:
			self._down = False
			if self.hit_test(x, y):
				self.value = not self.value
				if self.action:
					self.action(self)
				return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:pborky,项目名称:pyneuro,代码行数:13,代码来源:checkbox.py

示例6: on_mouse_release

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_release(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self._focused:
			nx = min(self._xoffset+self.w-self._xpad, max(self._xoffset, x))
			self.shapes['knob'].update(nx, self._yoffset, 1, 1)
			self._value = self._min + (nx-self._xoffset)/float(self.w-self._xpad)*(self._max-self._min)
			self.find_root().focus.pop()
			self._focused = False
			if self.action:
				self.action(self)
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:Elizabwth,项目名称:pyman,代码行数:15,代码来源:slider.py

示例7: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_press(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self.hit_test(x, y):
			self._focused = True
			self.find_root().focus.append(self)
			nx = min(self._xoffset+self.w-self._xpad, max(self._xoffset, x))
			self.shapes['knob'].update(nx, self._yoffset, 1, 1)
			self._value = self._min + (nx-self._xoffset)/float(self.w-self._xpad)*(self._max-self._min)
			if self._continuous and self.action:
				self.action(self)
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:Elizabwth,项目名称:pyman,代码行数:15,代码来源:slider.py

示例8: on_mouse_release

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_release(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self._down:
			nx = min(self._xoffset+self.w-self._xpad, max(self._xoffset, x - self._gx))
			self.elements['knob'].color = (0.25, 0.25, 0.25, 1.0)
			self.elements['knob'].update(nx, self._yoffset, 1, 1)
			self._value = self._min + nx/float(self.w-8)*(self._max-self._min)
			self._down = False
			if self.action:
				self.action(self)
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:pborky,项目名称:pyneuro,代码行数:15,代码来源:slider.py

示例9: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_press(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self.hit_test(x, y) and not self._focused:
			self._focused = True
			self.find_root().focus.append(self)
			self.label.caret.visible = True
			self.label.caret.on_mouse_press(x, y, button, modifiers)
			return pyglet.event.EVENT_HANDLED
		if button == pyglet.window.mouse.LEFT and self._focused:
			if self.hit_test(x, y):
				self.label.caret.on_mouse_press(x, y, button, modifiers)
			else:
				self.label.caret.visible = False
				self.find_root().focus.pop()
				self._focused = False
				if self.action:
					self.action(self)
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:irskep,项目名称:Aerthian,代码行数:22,代码来源:text_input.py

示例10: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
	def on_mouse_press(self, x, y, button, modifiers):
		if button == pyglet.window.mouse.LEFT and self.hit_test(x, y) and not self._focused:
			self.elements['frame'].color = (0.65, 0.65, 0.65, 0.65)
			self._focused = True
			self.find_root().focus.append(self)
			self.caret.visible = True
			self.caret.on_mouse_press(x - self._gx - 2, y - self._gy - 2, button, modifiers)
			return pyglet.event.EVENT_HANDLED
		if button == pyglet.window.mouse.LEFT and self._focused:
			if self.hit_test(x, y):
				self.caret.on_mouse_press(x - self._gx - 2, y - self._gy - 2, button, modifiers)
			else:
				self.caret.visible = False
				self.find_root().focus.pop()
				self._focused = False
				self.elements['frame'].color = (0.75, 0.75, 0.75, 0.75)
				if self.action:
					self.action(self)
			return pyglet.event.EVENT_HANDLED
		
		Widget.on_mouse_press(self, x, y, button, modifiers)
		return pyglet.event.EVENT_UNHANDLED
开发者ID:pborky,项目名称:pyneuro,代码行数:24,代码来源:text_input.py

示例11: on_mouse_press

# 需要导入模块: from widget import Widget [as 别名]
# 或者: from widget.Widget import on_mouse_press [as 别名]
 def on_mouse_press(self, x, y, *args):
     Widget.on_mouse_press(self, x, y, *args)
     if self._hit(x, y) and self._caret:
         return self._caret.on_mouse_press(x, y, *args)
开发者ID:obspy,项目名称:branches,代码行数:6,代码来源:entry.py


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