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


Python Image.size方法代码示例

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


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

示例1: on_touch_down

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [as 别名]
	def on_touch_down(self, touch):
		userdata = touch.ud
		(w, h) = Window.size
		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
开发者ID:Sebelino,项目名称:Team18,代码行数:28,代码来源:Football.py

示例2: update_text

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [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
开发者ID:matbur95,项目名称:pascal,代码行数:13,代码来源:quiz.py

示例3: question

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [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
开发者ID:matbur95,项目名称:pascal,代码行数:13,代码来源:quiz.py

示例4: my_callback

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [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
开发者ID:ONETOOZERO,项目名称:fbox,代码行数:42,代码来源:main.py

示例5: _addButton

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [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
开发者ID:cassab,项目名称:Decorato_Sketching,代码行数:15,代码来源:collectionviewer.py

示例6: showInitialHelp

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [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

示例7: on_pre_enter

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [as 别名]
 def on_pre_enter(self):
     interior_img = Image(source=shipimage.ship_dict[self.ship.shipclass]['prefix']+ '/ShipRooms.png',color=[0.5,0.5,0.5,1.], allow_stretch=True, size_hint= [None, None])
     interior_img.size = densFix(interior_img.texture.size)
     interior_img.pos_hint= {'center_x': .5, 'center_y': .5}
     self.ids['shiplayout'].add_widget(interior_img)
     self.ids['shiplayout'].size = (np.array(interior_img.size)+100).tolist()
     
     #add rooms
     for r in self.ship.rooms:
         #mimg = r['module'].module_image()
         rimg = RoomImage( room_entry=r )
         #butt.text = str(r['size'])
         #room_name = 'room'+str(r['size'])+'_'
         #room_name += 'empty.png' if not r['module'] else 'full.png'
         b_center = np.array(self.ids['shiplayout'].center)+np.array(r['loc'])*Metrics.density        
         #print r_center, np.array(self.ids['shiplayout'].center),np.array(r['loc'])       
         #room_img = Image(source='img/room/'+room_name, center = r_center.tolist(), size=[40,40], size_hint= [None, None])
         #rimg.center = b_center.tolist()
         rimg.go_to_loc(b_center.tolist())
         #rimg.ids['sizeimg'].pos_hint = 0.5,0.5
         self.ids['shiplayout'].add_widget(rimg)
         
     self.ids['shipscroll'].scroll_x = 0.5
     self.ids['shipscroll'].scroll_y = 0.5
开发者ID:facepalm,项目名称:star-nomads,代码行数:26,代码来源:shippanel.py

示例8: build

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import size [as 别名]
    def build(self):

        #Window.size = (1920,1080)
        #Window.size = (1200,900)
        self.lists={}
        self.counters={}
        self.buttons={}
        self.labels={}
        self.on=False
        self.phase=""
        diplayLayout=currentDir+"kivyDisplay.txt"

        global displayLock
        displayLock = DisplayLock()
        
        self.layout=[]
        with open(diplayLayout, 'rb') as layoutFile:
            #layoutReader = csv.reader(layoutFile, delimiter=',', quotechar='|')
            for row in layoutFile:
                i=row.rstrip('\n')
                j=i.rstrip('\r')
                k=j.split(",")
                if len(k)==6:
                    self.layout.append(j.split(","))
                else:
                    print "INVALID LAYOUT LINE:",k


        self.relativeLayout = RelativeLayout()
        self.relativeLayout.size_hint=(None, None)
        #self.relativeLayout.pos_hint={'x':0,'y':0}

        background = Image(source="background.jpg", allow_stretch=True, keep_ratio=True)
        background.size= (Window.height*background.image_ratio, Window.height)
        self.relativeLayout.add_widget(background)
        
        self.tableau=0
        
        CardList.setDisplay(self)
        CardPile.setDisplay(self)
        CardCounter.setDisplay(self)
        
        deck = Deck(currentDir+"classes.txt",currentDir+"soldiers.txt",KivyCard)


        numberPlayers=1

        self.tableau = Tableau(deck,numberPlayers,self,KivyCardPile,KivyCardList,KivyCardCounter)

        engine = GameEngine(self.tableau)

        
        
        self.initDisplay()

        global looking
        global lookingCard
        looking = False
        lookingCard = False
        self.buttons["look"].enable(True,True)
        
        engineThread=EngineThread(engine)
        engineThread.start()
        
        return self.relativeLayout
开发者ID:a74nh,项目名称:IndefiniteQuantity,代码行数:67,代码来源:kivyDisplay.py


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