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


Python Image.allow_stretch方法代码示例

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


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

示例1: handleGoal

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import allow_stretch [as 别名]
    def handleGoal(self):
        def go_next_callback(instance):
            self.popup.dismiss()
            main.switchLevel()
            return False
            
        if self.isToolOnGoal and self.isPersonOnGoal:
            if self.activeTool.isGoal and self.activePerson.isGoal:
                print "FINISHED? ",isFinished
                while not isFinished: #notwendig, weil sonst 2 mal aufgerufen (touch_events feuern alle 2 mal)
                    global isFinished
                    isFinished = True
                    
                    btnBGSource = ''
                         
                    if currentLevel <= len(levels)-1:
                        btnBGSource = unichr(61518)
                    else:
                        btnBGSource = unichr(61470)
                                           
                    box = AnchorLayout(size_hint=(1, 1), anchor_x= "right", anchor_y= "bottom")     
                    btn = Button(font_size=100, font_name= 'res/fontawesome-webfont.ttf', text=btnBGSource, background_color = [0,0,0,0.7])
                    btn.bind(on_press=go_next_callback)
                    
                    #vid = Video(source=self.levelInfos[levelProps[3]], play=True)                    
                    #box.add_widget(vid)
                    
                    #instead of laggy video insert just an image
                    img = Image(source=self.levelInfos[levelProps[3]])
                    img.allow_stretch = True
                    box.add_widget(img)
                    imgBtn = Button(font_size=60, font_name= 'res/fontawesome-webfont.ttf', text=btnBGSource, background_color = [0,0,0,0], size_hint= (0.15, 0.15))
                    imgBtn.bind(on_press=go_next_callback)
                    box.add_widget(imgBtn)
                    
                    def end_of_vid(video, eos):
                        logging.info("endofvid")
                        #video.play=False #not working on android...
                        box.add_widget(btn)
                        #video.unload() #not working on android...
                        #logging.info("video unloaded")
                        
                    def showit():
                        print "showing video popup"
                        self.popup.open()
                        if self.winSound:
                            self.winSound.play()

                    #vid.bind(loaded=lambda foo,bar: showit())
                    #vid.bind(eos=lambda video,eos:end_of_vid(video,eos))
                                                                          
                         
                    self.popup = Popup(content=box,size_hint=(0.8, 0.7),auto_dismiss=False)
                    
                    self.hidePopupTitle(self.popup)
                    
                    showit()
                    Clock.schedule_once(lambda wumpe:box.add_widget(btn), 8)
开发者ID:HSA-IMS-Kivy-2,项目名称:Master_Emergency_Situations,代码行数:60,代码来源:main.py

示例2: resimleriEkle

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import allow_stretch [as 别名]
 def resimleriEkle(self, dosyalar):
     self.root.ids.karinca.clear_widgets()
     for dosya in dosyalar:
         if os.path.isfile(dosya):
             if imghdr.what(dosya):
                 resim=Image(source=dosya)
                 resim.allow_stretch=True
                 resim.keep_ratio=False
                 self.root.ids.karinca.add_widget(resim)
 
     if self.root.ids.karinca.slides:
         self.root.ids.slyat_dugme.disabled=False
     else:
         self.root.ids.slyat_dugme.disabled=True
开发者ID:mbaser,项目名称:kivy-tr,代码行数:16,代码来源:main.py

示例3: move_to_exhibit

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import allow_stretch [as 别名]
	def move_to_exhibit(self, dt=0, index=None):
		if index is None:
			index = self.currentindex

		data = self.exhibits[index]
		label = Label(text=data['description'], font_size=self.root.ids.MainButton.font_size)
		label.size_hint_y = 0.3
		image = Image(source=data['visualurl'], scale=2)
		image.allow_stretch = True
		self.show(label, image)

		reqstring = HOST + '?' + str(data['x']) + '&' + str(data['y']) + '&' + str(data['phi'])
		req = UrlRequest(reqstring)

		sleep(int((int(data['x']) ** 2 + int(data['y']) ** 2) ** 0.5 / float(SPEED)))
		self.sound = SoundLoader.load(data['audiourl'])
		self.sound.play() 
		Clock.schedule_once(self.scheduler, self.sound.length + 7)
开发者ID:fmulp,项目名称:Robot_Guide,代码行数:20,代码来源:main.py

示例4: __init__

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import allow_stretch [as 别名]
    def __init__(self, **kwargs):
        super(RootWidget, self).__init__(**kwargs)

        if bHooking:
            print "bHooking is true"
            self.hm = hooklib.HookManager()
            print "HookManager set to self.hm"
            self.hm.HookKeyboard()
            self.hm.KeyDown = self.OnKeyDownEvent
            self.hm.start()

        self.photos = []
        self.shown = []
        self.photos = glob.glob(strDir + "*.jpg")
        global intCount
        #global sngInterval
        intCount = len(self.photos)
        strImage = random.choice(self.photos)
        img = Image(source=strImage, id='MainImage')
        img.nocache = True
        #img.canvas.color = (1, 1, 1)
        #Turn on allow_stretch to upscale smaller images to fullscreen
        img.allow_stretch = True
        
        self.add_widget(img)

        if True:
            cb = CustomBtn(size_hint=(1,1), font_size=strFontSize)
            cb.bind(pressed=self.btn_pressed)
            #cb.text = 'This is a test.'
            cb.id = 'MainButton'
            cb.bind(texture_size=cb.setter('size'))
            cb.bind(size=cb.setter('text_size')) 
            self.add_widget(cb)
        
        self.show_next_image()
        if not bReschedule:
            Clock.unschedule(self.show_next_image)
            Clock.schedule_interval(self.show_next_image, sngInterval)
        if bUseLCD:
            Clock.schedule_interval(self.CheckLCD, 0.1)
开发者ID:DaveZahn,项目名称:APOD_Viewer,代码行数:43,代码来源:APOD_Viewer_Raspbian.py

示例5: showInitialHelp

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import allow_stretch [as 别名]
 def showInitialHelp(self):        
     def go_next_callback(instance):
         self.ids.popupanchor.remove_widget(self.helpPopup)
         return False
     
     box = AnchorLayout(size_hint=(1, 1), anchor_x= "right", anchor_y= "bottom")
     
     img = Image(source='res/help.zip')
         
     img.anim_delay= 0.05
     box.add_widget(img)
     skipBtn = Button(font_size=80, font_name= 'res/fontawesome-webfont.ttf',markup=True, text='[color=49E449]'+unichr(61764)+'[/color]', background_color = [0,0,0,0], size_hint= (0.2, 0.2))
     skipBtn.bind(on_press=go_next_callback)
     box.add_widget(skipBtn)
     
     self.helpPopup = Popup(content=box,size_hint=(0.8, 0.7),auto_dismiss=False)
     self.hidePopupTitle(self.helpPopup)
     
     self.ids.popupanchor.add_widget(self.helpPopup)
     self.helpPopup.open()
     img.size=self.ids.popupanchor.size
     img.allow_stretch = True
开发者ID:HSA-IMS-Kivy-2,项目名称:Master_Emergency_Situations,代码行数:24,代码来源:main.py

示例6: __init__

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import allow_stretch [as 别名]
 def __init__(self, **kwargs):
     super(RootWidget, self).__init__(**kwargs)
     self.photos = []
     self.shown = []
     self.photos = glob.glob(strDir + "*.jpg")
     global intCount
     #global sngInterval
     intCount = len(self.photos)
     strImage = random.choice(self.photos)
     img = Image(source=strImage, id='MainImage')
     #Turn on allow_stretch to upscale smaller images to fullscreen
     img.allow_stretch = True
     self.add_widget(img)
     cb = CustomBtn(size_hint=(1,1), font_size=strFontSize)
     cb.bind(pressed=self.btn_pressed)
     #cb.text = 'This is a test.'
     cb.id = 'MainButton'
     cb.bind(texture_size=cb.setter('size'))
     cb.bind(size=cb.setter('text_size')) 
     self.add_widget(cb)
     self.next_image()
     if not bReschedule:
         Clock.schedule_interval(self.next_image, sngInterval)
开发者ID:DaveZahn,项目名称:APOD_Viewer,代码行数:25,代码来源:main.py


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