本文整理汇总了Python中kivy.uix.image.Image.x方法的典型用法代码示例。如果您正苦于以下问题:Python Image.x方法的具体用法?Python Image.x怎么用?Python Image.x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.image.Image
的用法示例。
在下文中一共展示了Image.x方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import x [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
示例2: create_blob
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import x [as 别名]
def create_blob(self, touch):
# define a short name for the touch-specific and unique UserDictionary "ud"
ud = touch.ud
# create the new blob
ud['blob'] = Image(
source=self.parent.app.config.get('Advanced', 'BlobImage'),
color=BLOB_IMAGE_COLOR,
allow_stretch=True,
size=(self.parent.app.config.getint('Advanced', 'BlobSize'), self.parent.app.config.getint('Advanced', 'BlobSize')))
# set the blobs position right under the finger
ud['blob'].x = touch.x - ud['blob'].size[0] / 2
ud['blob'].y = touch.y - ud['blob'].size[1] / 2
self.add_widget(ud['blob'])
示例3: create_circle
# 需要导入模块: from kivy.uix.image import Image [as 别名]
# 或者: from kivy.uix.image.Image import x [as 别名]
def create_circle(self, touch):
# create the circle image
circle = Image(
source=self.app.config.get('Advanced', 'CircleImage'),
color=CIRCLE_IMAGE_COLOR,
allow_stretch=True,
size=(self.app.config.getint('Advanced', 'CircleSize'), self.app.config.getint('Advanced', 'CircleSize')))
# center the circle on the finger position
circle.x = touch.x - circle.size[0] / 2
circle.y = touch.y - circle.size[1] / 2
self.add_widget(circle)
# and just right fade it out after having displayed it
animation = Animation(
color=CIRCLE_IMAGE_COLOR_TRANSPARENT,
size=(self.app.config.getint('Advanced', 'CircleSize') * 2, self.app.config.getint('Advanced', 'CircleSize') * 2),
x=circle.pos[0] - (self.app.config.getint('Advanced', 'CircleSize')/2), # workaround for centering the image during resizing
y=circle.pos[1] - (self.app.config.getint('Advanced', 'CircleSize')/2), # workaround for centering the image during resizing
t='out_expo', duration=CIRCLE_IMAGE_FADEOUT_TIME)
animation.start(circle)
animation.bind(on_complete=self.circle_fadeout_complete)