简体   繁体   English

如何在 Kivy 中指定视频大小

[英]How to specify video size in Kivy

I'm trying to get VideoPlayer class to pick up on window size of the widget that's within.我正在尝试让 VideoPlayer 类了解其中的小部件的窗口大小。 It picks up on the size when used like this:像这样使用时它的大小会增加:

def build(self):
    game = Game()
    Window.size = game.size
    video = VideoPlayer()
    return video

but since I'm playing the video within the Game class it won't pick up on the size automatically.但由于我在游戏类中播放视频,它不会自动调整大小。 What else I can do?我还能做什么?

I tried sensible solution:我尝试了明智的解决方案:

video._video = Window.size

and also:并且:

video.on_fullscreen(self, self.size)  # a method I found in source code of the VideoPlayer class

None of it helped.这些都没有帮助。

Would be将会

def build(self):
    game = Game()
    #changing size and position
    #game.change_position(x,y)
    #game.set_size(z,m)
    video = VideoPlayer()
    game.add_widget(video) 
    return game 

Don't know the interfaces of Game()不知道Game()的接口

Solution was simpler than I thought:解决方案比我想象的要简单:

video.size = (Window.size[0],Window.size[1])
return game

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM