本文整理汇总了Python中kivy.uix.screenmanager.Screen.on_touch_down方法的典型用法代码示例。如果您正苦于以下问题:Python Screen.on_touch_down方法的具体用法?Python Screen.on_touch_down怎么用?Python Screen.on_touch_down使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.screenmanager.Screen
的用法示例。
在下文中一共展示了Screen.on_touch_down方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_touch_down
# 需要导入模块: from kivy.uix.screenmanager import Screen [as 别名]
# 或者: from kivy.uix.screenmanager.Screen import on_touch_down [as 别名]
def on_touch_down(self, touch):
if self.bTowerShadowOn:
bCanAddTower = True
towerGridStartPoint = Point(self._correctPosition(touch.x)-Tower.size_x/2, self._correctPosition(touch.y)-Tower.size_y/2)
towerGridEndPoint = Point(self._correctPosition(touch.x)+Tower.size_x/2, self._correctPosition(touch.y)+Tower.size_y/2)
if self.screenGrid.isColliding(towerGridStartPoint, towerGridEndPoint):
#print "WARNING! cannot built tower on other widgets"
bCanAddTower = False
if bCanAddTower == True:
towerPosX = self._correctPosition(touch.x)
towerPosY = self._correctPosition(touch.y)
self.addTower(Point(towerPosX, towerPosY))
self.remove_widget(self.towerShadow)
del self.towerShadow
return Screen.on_touch_down(self, touch)