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


Python Image.texture方法代码示例

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


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

示例1: build

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import texture [as 别名]
 def build(self):
     label = Label(text="Testing going on.")
     atlas = Atlas("player_sheet.atlas")
     image1 = Image(allow_stretch=True)
     image1.texture = atlas["walkleft4"]
     label.add_widget(image1)
     return label
开发者ID:Exodus111,项目名称:Projects,代码行数:9,代码来源:test.py

示例2: open_mag_glass

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import texture [as 别名]
    def open_mag_glass(self):
        Logger.debug('my id=%s' % str(self.id))

        mag_glass_setting_x = int(App.get_running_app().config.get('Display', 'mag_glass_size'))
        mag_glass_setting_y = int(App.get_running_app().config.get('Display', 'mag_glass_size'))

        comic_image_id = self.id.replace('comic_scatter','pi_')
        print App.get_running_app().root.ids
        try:
            for child in self.walk():
                print child.id
                if child.id == comic_image_id:
                    image_w = child
                    Logger.debug('>>>>>Found grandchild named %s this is the image' %comic_image_id)
                elif child.id == 'mag_glass':
                    mag_glass_w = child
        except:
           Logger.critical('Some bad happened in _call_mag')
        else:
            print 'image_w = %s' % str(image_w)
            if self.move_state == 'open':
                self.move_state = 'locked'
                self.do_scale=False
                self.do_translation=False
                Logger.debug('image_w.center = %d,%d' % (image_w.center_x,image_w.center_y))

                mag_glass = MagnifyingGlassScatter(size=(mag_glass_setting_x,mag_glass_setting_y),size_hint = (None, None),
                                                        do_rotation=False, do_scale=False,
                                                        pos=((image_w.center_x-(mag_glass_setting_x/2)),
                                                             (image_w.center_y-(mag_glass_setting_y/2))
                                                         ),id='mag_glass'
                                                  )
                mag_glass.page_widget = image_w
                mag_glass_image = Image(size_hint= (None,None),pos_hint={'x':1, 'y':1},id='mag_image',keep_ratio=True,
                                        allow_stretch=False,size=mag_glass.size )
                mag_glass.mag_img = mag_glass_image
                mag_glass_image.texture = image_w.texture.get_region(
                                            mag_glass.x,mag_glass.y,mag_glass_setting_x,mag_glass_setting_y)
                mag_glass.add_widget(mag_glass_image)
                self.add_widget(mag_glass)
            else:
                self.move_state = 'open'
                self.do_scale=True
                self.do_translation=True

                self.remove_widget(mag_glass_w)
开发者ID:gwhittey23,项目名称:CSVDriod,代码行数:48,代码来源:comic_screen.py

示例3: get_region

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import texture [as 别名]
	def get_region(self, pos):
		num_wide = self.texture.size[0] / self.tile_size[0]
		num_high = self.texture.size[1] / self.tile_size[1]
		if num_high == 0 or num_wide == 0:
			return (0,0,1,1)
		if pos > num_wide * num_high:
			return None
			#this is an error
		else:	
			#(x,y) = (0,0)
			x = pos % num_wide * self.tile_size[0]
			y = pos / num_wide * self.tile_size[1]
			Logger.info('%d %d %d, %d %d',pos, num_wide, num_high, x, y )
			#self.texture = self.image.texture.get_region(x,y,width,height)
			r = Image(size=self.tile_size)
			r.texture = self.texture.get_region(x,y,self.tile_size[0],self.tile_size[1])
			return r
开发者ID:ianhook,项目名称:Carcassonne,代码行数:19,代码来源:tileimage.py

示例4: _image_downloaded

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import texture [as 别名]
    def _image_downloaded(self, widget ,comicstream_number, proxyImage,):
        '''Fired once the image is downloaded and ready to use'''
        if proxyImage.image.texture:
            base_url = App.get_running_app().config.get('Server', 'url')
            src_thumb = "%s/comic/%d/page/%d?max_height=200#.jpg" % (base_url, comicstream_number, self._index)
            app = App.get_running_app()
            inner_grid_id ='inner_grid' + str(self._index)
            page_image_id = str(self._index)
            split_dbl_page = App.get_running_app().config.get('Display', 'dblpagesplit')
            if proxyImage.image.texture.width > 2*Window.width and split_dbl_page == '1':
                m_win_x = Window.width
                m_win_y = Window.height
                self.texture = proxyImage.image.texture
                c_width = self.texture.width
                c_height = self.texture.height
                part_1 = Image()
                part_1_thumb = Image()
                scatter = ComicScatter(do_rotation=False, do_scale=False,do_translation_x=False,
                                       id='comic_scatter'+str(self._index)+'b',scale_min=1, scale_max=2,
                                       size_hint=(None,None), size = (m_win_x,m_win_y),
                                   )
                part_2 = ComicImage(_index=self._index+1,nocache=False,keep_ratio=False,allow_stretch=True,
                                     id='pi_'+str(self._index)+'b',size_hint = (None,None),size=self.size
                                          )
                scatter.add_widget(part_2)
                part_1.texture = proxyImage.image.texture.get_region(0,0,c_width/2,c_height)
                part_2.texture = proxyImage.image.texture.get_region((c_width/2+1),0,c_width/2,c_height)
                self.texture = part_1.texture
                app.root.ids['comicscreenid'].ids['my_carousel'].add_widget(scatter,self._index+1)
                inner_grid = GridLayout(cols=1, rows =2,id='inner_grid'+str(self._index),size_hint=(None,None),
                                        size=(130,200), spacing=5)
                page_thumb = PageThumbImage(allow_stretch=True,
                                        size=(130,200),size_hint=(None, None),id=str(self._index),_index=self._index)
                page_thumb.texture = part_1.texture
                inner_grid.add_widget(page_thumb)
                page_thumb.parent.bind(pos=app.root.setter('pos'))
                page_thumb.parent.bind(pos=app.root.setter('pos'))
                page_thumb.bind(on_press=app.root.pop.dismiss)
                page_thumb.bind(on_press=page_thumb.click)
                smbutton = Button(size_hint=(None,None),size=(10,10),text='P%sa'%str(self._index+1),text_color=(0,0,0),
                background_color=(1,1,1,.5))

                inner_grid.add_widget(smbutton)
                widget.add_widget(inner_grid)

                inner_grid = GridLayout(cols=1, rows =2,id='inner_grid'+str(self._index+1),size_hint=(None,None),
                                        size=(130,200), spacing=5)
                part_2_thumb = PageThumbImage(allow_stretch=True,
                                        size=(130,200),size_hint=(None, None),id=str(self._index+1),_index=self._index+1)
                part_2_thumb.texture =part_2.texture
                inner_grid.add_widget(part_2_thumb)
                Logger.debug('ok it did it')
                part_2_thumb.parent.bind(pos=app.root.setter('pos'))
                part_2_thumb.parent.bind(pos=app.root.setter('pos'))
                part_2_thumb.bind(on_press=app.root.pop.dismiss)
                part_2_thumb.bind(on_press=part_2_thumb.click)
                smbutton = Button(size_hint=(None,None),size=(10,10),text='P%sb'%str(self._index+1) ,text_color=(0,0,0),
                background_color=(1,1,1,.5))

                inner_grid.add_widget(smbutton)
                widget.add_widget(inner_grid)

            else:
                if proxyImage.image.texture.width > 2*Window.width:
                   self.size_hint=(2,1)
                self.texture = proxyImage.image.texture
                inner_grid = GridLayout(cols=1, rows =2,id='inner_grid'+str(self._index),size_hint=(None,None),
                                        size=(130,200), spacing=5)
                page_thumb = PageThumbImage(source=src_thumb,allow_stretch=True,
                                        size=(130,200),size_hint=(None, None),id=str(self._index),_index=self._index)

                inner_grid.add_widget(page_thumb)
                page_thumb.parent.bind(pos=app.root.setter('pos'))
                page_thumb.parent.bind(pos=app.root.setter('pos'))
                page_thumb.bind(on_press=app.root.pop.dismiss)
                page_thumb.bind(on_press=page_thumb.click)
                smbutton = Button(size_hint=(None,None),size=(10,10),text='P%s'%str(self._index+1),text_color=(0,0,0),
                background_color=(1,1,1,.5))

                inner_grid.add_widget(smbutton)
                widget.add_widget(inner_grid)
开发者ID:gwhittey23,项目名称:CSVDriod,代码行数:83,代码来源:comic_screen.py

示例5: _proxy_loaded

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import texture [as 别名]
 def _proxy_loaded(self,proxyImage):
     if proxyImage.image.texture:
         x = Image(size=(130,200),allow_stretch=False,size_hint=(None, None))
         x.texture = proxyImage.image.texture
         Clock.schedule_once(partial(self.save_cover,x), .05)
开发者ID:gwhittey23,项目名称:DCSV3,代码行数:7,代码来源:comic_data.py


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