本文整理汇总了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)
示例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