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


Python Image.pos_hint方法代码示例

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


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

示例1: display

# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import pos_hint [as 别名]
    def display(self):
        background = Image(source="images/background2.png")
        clinic = Image(source="images/clinic.png", pos_hint={'x': .15, 'y': -0.05}, size_hint=(.7, .7))
        sun = Image(source="images/sun.png", size_hint=(.7, .7))
        sun.pos_hint = {'x': .15, 'y': 0.3};

        self.layout.add_widget(background)
        self.layout.add_widget(clinic)
        self.layout.add_widget(sun)

        if self.game_session.level.battery > 0:
            battery = Image(source="images/battery.png", size_hint=(.3, .38), pos_hint={'x': .1, 'y': .2})
            self.layout.add_widget(battery)

        self.time_label = Label(text="00:00:00",
                           font_size='24dp',
                           pos_hint={'x': .4, 'y': .01},
                           size_hint=(.2, .1))
        self.layout.add_widget(self.time_label)

        back_button = Button(text="<< Menu",
                              font_size='18dp',
                              pos_hint={'x': .01, 'y': 0.01},
                              size_hint=(.15, .075), on_press=self.callpopup)
        self.layout.add_widget(back_button)

        for i, appliance in enumerate(self.game_session.level.appliances):
            appliance.pos_hint = {'x': self.locations[i][0], 'y': self.locations[i][1]}
            appliance.size_hint = (.12, .12)
            self.layout.add_widget(appliance)

        self.layout.add_widget(self.current_load_label)
        self.add_widget(self.layout)
        Clock.schedule_interval(self.update, 1)
        Clock.schedule_interval(self.add_drop, 1/20)
        Clock.schedule_interval(self.move_rain, 1/20)
开发者ID:arwema,项目名称:EnergyGame,代码行数:38,代码来源:main.py

示例2: on_pre_enter

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


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