[Qt-interest] Problems with Qt and Videos!

Richard richardmg at trolltech.com
Tue Apr 14 08:35:21 CEST 2009


Unless the Python bindings does some special magic, it seems to me  
that you forgot to add your video widget as a child of the main window?
Or just add v_widget.show()

-Richard




Den Apr 11, 2009 kl. 12:53 AM skrev Luiz Vitor Martinez Cardoso:

> Dear,
>
> I'm trying to implement a simple Application that plays videos. I  
> read some parts of Qt4 documentation (mainly Phonon, VideoObject,  
> MediaSource, QString...) several times and now I can't figure what's  
> going wrong.
>
> The application runs without errors, but only shows a Window without  
> VideoWidget!
>
> Could anyone revise my code and point the mistake?
>
> from PyQt4.QtGui import QApplication
> from PyQt4.QtGui import QMainWindow
> from PyQt4.QtGui import QWidget
> from PyQt4.QtCore import QString
>
> from PyQt4.phonon import Phonon
>
> import sys
>
> def main(argv):
>     app = QApplication(argv)
>     app.setApplicationName("Videoz")
>     win = QMainWindow()
>
>     v_filename = QString("/Users/grabber/Downloads/twi/twi.avi")
>     vms_obj = Phonon.MediaSource(v_filename)
>
>     vm_obj = Phonon.MediaObject()
>     vm_obj.setCurrentSource(vms_obj)
>     v_widget = Phonon.VideoWidget()
>     Phonon.createPath(vm_obj, v_widget)
>
>     vm_obj.play()
>
>     win.setWindowTitle("Videoz")
>     win.show()
>     sys.exit(app.exec_())
>
> if __name__ == "__main__":
>     main(sys.argv)
>
> -- 
> Regards,
>
> Luiz Vitor Martinez Cardoso
> cel.: (11) 8187-8662
> blog: rubz.org
> engineer student at maua.br
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090414/483a1fb2/attachment.html 


More information about the Qt-interest-old mailing list