pyQT声子播放器全屏显示?
我想知道如何将声子播放器设置为全屏? 我正在尝试这个代码。
if not self.ui.videoPlayer.isFullScreen():
self.ui.videoPlayer.enterFullScreen()
else:
self.ui.videoPlayer.exitFullScreen()
但我不断收到此错误消息
类型错误:“sip.methoddescriptor”对象不可调用
上面的代码来自示例项目。原始代码是
def full(self):
if not self.videoWidget.isFullScreen():
self.videoWidget.enterFullScreen()
else:
self.videoWidget.exitFullScreen()
我在 PyQT 中重新创建的,这对我来说似乎很难。 谁能指导我缺少什么(有预感) 或者我做错了什么?
i was wondering how to set a phonon player to full screen?
im trying this codes.
if not self.ui.videoPlayer.isFullScreen():
self.ui.videoPlayer.enterFullScreen()
else:
self.ui.videoPlayer.exitFullScreen()
but i keep on getting this error message
TypeError: 'sip.methoddescriptor' object is not callable
the code above works is from a sample project. the original code was
def full(self):
if not self.videoWidget.isFullScreen():
self.videoWidget.enterFullScreen()
else:
self.videoWidget.exitFullScreen()
im recreating it in PyQT and it seems hard for me.
can anyone please guide me on what im missing(having a hunch about it)
or what im doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
VideoPlayer 与 VideoWidget。
VideoPlayer
是QWidget
的子类,因此它将有一个isFullScreen
方法 - 但它赢了' t有方法enterFullScreen
和exitFullScreen
,它们属于VideoWidget
类。但是,
VideoPlayer
类有一个 videoWidget 方法返回它使用的视频小部件的实例,因此您的代码示例可能应更改为:编辑
要提供退出全屏模式的方法,请设置键盘快捷键:
A VideoPlayer is not the same thing as a VideoWidget.
VideoPlayer
is a subclass ofQWidget
, so it will have anisFullScreen
method - but it won't have the methodsenterFullScreen
andexitFullScreen
, which belong to theVideoWidget
class.However, the
VideoPlayer
class has a videoWidget method which returns the instance of the video widget it uses, so your code example should probably be changed to:EDIT
To provide a method for exiting fullscreen mode, set up a keyboard shortcut:
我认为问题是您使用
self.ui.videoPlayer.isFullScreen
,它可能返回 True 或 False,当您使用self.ui.videoPlayer.isFullScreen()
时实际上解析为“False()”。奇怪的是,PyQT 文档 没有甚至将“isFullScreen”列为可用方法/属性的一部分。但是 QWidget 文档 确实显示 isFullScreen 作为返回一个布尔值。
相反,试试这个:
I think the problem is your use of
self.ui.videoPlayer.isFullScreen
, it's probably returning True or False, which when you useself.ui.videoPlayer.isFullScreen()
is really resolving down to 'False()'.Oddly enough, the PyQT documentation doesn't even list 'isFullScreen' as part of the available, methods/properties. However the QWidget documentation does show isFullScreen as returning a boolean.
Instead, try this: