本文整理汇总了Python中kivy.uix.image.Image.pos方法的典型用法代码示例。如果您正苦于以下问题:Python Image.pos方法的具体用法?Python Image.pos怎么用?Python Image.pos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.image.Image
的用法示例。
在下文中一共展示了Image.pos方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_touch_down
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def on_touch_down(self, touch):
userdata = touch.ud
(w, h) = (FSW,FSH)
sc = max(float(w)/FSW,float(h)/FSH)
# start collecting points in touch.ud
self.canvas.clear
gimg = Image(source=GOAL_IMG)
self.add_widget(gimg)
bimg = Image(source=BALL_IMG)
self.add_widget(bimg)
(xpos, ypos) = (int(touch.x)-w/2, int(touch.y)-h/2)
#bimg.size = (10,10) #(int(60.0*sc), int(60.0*sc))
bimg.pos = (xpos, ypos)
#print '{0} and {1}'.format(float(w)/FSW,float(h)/FSH) 2115
#print sc
print '{0} and {1}'.format(touch.x, touch.y)
#print '{0} and {1}'.format(xpos, ypos)
if touch.x > FSW/20 and touch.x < w-FSW/20 and touch.y > h*0.2 and touch.y < h*0.88:
print "GOAL!"
mimg = Image(source=MSG_IMG)
self.add_widget(mimg)
#with self.canvas:
#Color(1, 1, 1)
#d = 60.
#Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
return True
示例2: __init__
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def __init__(self, *args, **kwargs):
super(Goal, self).__init__(*args, **kwargs)
print "__init__ is run"
gimg = Image(source=GOAL_IMG)
self.add_widget(gimg)
gimg.pos = (0,0)
#Window.fullscreen = True
Window.size = (FSW, FSH)
示例3: on_check
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def on_check(self, instance, value):
sheepimg = Image(source='images/TXT_BRAVO_MOUTONS.png', size_hint=(None, None), size=(300, 150))
self.add_widget(sheepimg)
sheepimg.pos = (300, 300)
self.button = BtnOk(scenario=self)
self.button.center = (630, 270)
self.button.button.background_normal = 'images/BUT_OK_UNVALID.png'
self.button.button.background_down = 'images/BUT_OK_VALID.png'
self.add_widget(self.button)
示例4: update_text
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def update_text(self, i):
self.y = self.height * i
ans = self.answer
if ans.is_img:
img = Image(source=ans.img_path)
img.pos = self.pos
img.size = self.size
self.add_widget(img)
else:
self.text = ans.text
示例5: question
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def question(self, que):
self.restore_default()
self._question = que
if que.is_img:
img = Image(source=que.img_path)
img.pos = self.pos
img.size = self.size
self.add_widget(img)
else:
self.text = que.text
示例6: my_callback
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def my_callback(screen, dt):
global timeCountdown
global pictureCounter
timeCountdown = timeCountdown-1
screen.ids.hsCountdown.text = str(timeCountdown)
screen.ids.hsLabel.color = [1, 1, 0, 0] # black it out
screen.ids.hsButton.color = [1, 1, 0, 0] # black it out
screen.ids.hsButton.background_color = [1, 1, 0, 0] # black it out
Logger.info(str(timeCountdown)) #screen.ids.hsDebug1.text = screen.ids.hsDebug1.text + str(timeCountdown)
if (timeCountdown == 0):
# start a new thread with the actual capturing process
Thread(target=screen.captureImageThread, args=(screen.camera,screen.inspectImage,)).start()
screen.ids.hsCountdown.text = ""
timeCountdown = 5
# screen.run_command('gphoto2 --camera "Canon EOS 60D" --capture-and-download --filename "hallo.jpg"')
#screen.ids.hsDebug1.text = screen.ids.hsDebug1.text + str(cmd)
if (pictureCounter == 4):
preview04 = Image(source='preview04.jpg')
preview04.size = (400,240)
preview04.pos = (0,240)
screen.add_widget(preview04, 100)
Clock.unschedule(screen.my_callback)
if (pictureCounter == 3):
preview03 = Image(source='preview03.jpg')
preview03.size = (400,240)
preview03.pos = (400,0)
screen.add_widget(preview03, 100) # TODO move to layer 100
pictureCounter = 4
if (pictureCounter == 2):
preview02 = Image(source='preview02.jpg')
preview02.size = (400,240)
preview02.pos = (0,0)
screen.add_widget(preview02, 100) # TODO move to layer 100
pictureCounter = 3
if (pictureCounter == 1):
preview01 = Image(source='preview01.jpg')
preview01.size = (400,240)
preview01.pos = (400,240)
screen.add_widget(preview01, 100)
pictureCounter = 2
示例7: _addButton
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def _addButton(self, parent, name, source, size, pos, action_func, on_top=False):
button = Image(source=source)
button.size = size
button.on_top = on_top
button.pos = pos
button.scale = 1.
button.rotation = 0.
button.action = action_func
button.name = name
self.objects.update({name: {'obj': button}})
parent.add_widget(button)
return button
示例8: killWolf
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def killWolf(self, widget):
self.remove_widget(self.wolf)
self.remove_widget(self.info)
sheemimg = ObjectProperty(None)
if self.collardog:
sheepimg = Image(source='images/TXT_BRAVO_MOUT_2.png', size_hint=(None, None), size=(300, 150))
else:
sheepimg = Image(source='images/TXT_FAIL.png', size_hint=(None, None), size=(300, 150))
sheepimg.pos = (300, 300)
self.add_widget(sheepimg)
self.button = BtnOk(scenario=self)
self.button.center = (630, 270)
self.button.button.background_normal = 'images/BUT_OK_UNVALID.png'
self.button.button.background_down = 'images/BUT_OK_VALID.png'
self.add_widget(self.button)
tmp = Retry(wa=self)
self.retry = BtnOk(scenario=tmp)
self.retry.center = (470, 270)
self.retry.button.background_normal = 'images/BUT_BACK_UNVALID.png'
self.retry.button.background_down = 'images/BUT_BACK_VALID.png'
self.add_widget(self.retry)
示例9: __init__
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos [as 别名]
def __init__(self, *args, **kwargs):
super(Goal, self).__init__(*args, **kwargs)
print "__init__ is run"
gimg = Image(source=GOAL_IMG)
self.add_widget(gimg)
gimg.pos = (0,0)