本文整理汇总了Python中kivy.uix.image.Image.width方法的典型用法代码示例。如果您正苦于以下问题:Python Image.width方法的具体用法?Python Image.width怎么用?Python Image.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.image.Image
的用法示例。
在下文中一共展示了Image.width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addImage
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import width [as 别名]
def addImage(self, filename):
image = Image(source=filename)
image.size_hint = None, None
image.width = metrics.sp(120)
image.height = metrics.sp(120)
self.add_widget(image)
return
示例2: build
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import width [as 别名]
def build(self):
self.title = "Blackjack"
self.parent = Widget()
sm = ScreenManager()
# set up the screens
#splashcreen
self.ss = Screen(name = 'splash_screen')
splashmenu = SplashScreen()
splashmenu.buildUp()
self.ss.add_widget(splashmenu)
#main menu
self.mm = Screen(name = 'main_menu')
self.mainmenu = MainMenu()
self.mainmenu.buildUp()
self.mm.add_widget(self.mainmenu)
#add the logo to mainmenu and splashscreen
logo = Image(source = 'images/logo.png')
logo.width = Window.width/2
logo.height = Window.height/2
logo.x = Window.width/2 - (logo.width-logo.width*.05)
logo.y = (Window.height/2 - logo.width/2)
self.mm.add_widget(logo)
#game screen
self.gs = Game(name = 'game')
#Add screens to screen manager
sm.add_widget(self.ss)
sm.add_widget(self.mm)
sm.add_widget(self.gs)
sm.current = 'main_menu'
def check_screen_change(obj):
if(self.mainmenu.buttonText == 'Play'):
sm.current = 'game'
self.gs.start_round()
self.mainmenu.bind(on_button_release = check_screen_change)
return sm
示例3: __init__
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import width [as 别名]
def __init__(self, height: int, **kwargs):
super(TopBar, self).__init__(**kwargs)
topBack = Image()
topBack.color = [0, 0, 0, 1]
topBack.width = Window.size[0]
topBack.height = height
self.add_widget(topBack)
self.__grid = GridLayout()
self.__grid.cols = 10
self.__grid.rows = 1
self.__grid.width = Window.size[0]
self.__grid.height = height
self.add_widget(self.__grid)