Skip to main content

PyQt music player widget

Project description

pyqt-music-player-widget

PyQt music player widget

Requirements

PyQt5 >= 5.8

Setup

python -m pip install pyqt-music-player-widget

Included Packages

This is using mutagen to get the full length of the media.

This only works for mp3 extension.

Method/Signal Overview

  • Methods - play(), pause(), stop()

  • Signals - played(bool), positionUpdated(int), durationUpdated(int)

Example

from PyQt5.QtWidgets import QWidget, QVBoxLayout, QApplication, QFormLayout

from pyqt_find_path_widget import FindPathWidget  # https://github.com/yjg30737/pyqt-find-path-widget.git



from pyqt_music_player_widget import MusicPlayerWidget





class MusicPlayerExample(QWidget):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        self.__findPathWidget = FindPathWidget()

        self.__findPathWidget.setExtOfFiles('Audio Files (*.mp3)')

        self.__findPathWidget.added.connect(self.__added)



        lay = QFormLayout()

        lay.addRow('Audio File', self.__findPathWidget)

        lay.setContentsMargins(0, 0, 0, 0)



        pathFindWidget = QWidget()

        pathFindWidget.setLayout(lay)



        self.__musicPlayerWidget = MusicPlayerWidget()



        lay = QVBoxLayout()

        lay.addWidget(pathFindWidget)

        lay.addWidget(self.__musicPlayerWidget)



        self.setLayout(lay)



    def __added(self, filename: str):

        self.__musicPlayerWidget.setMedia(filename)





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    player = MusicPlayerExample()

    player.show()

    sys.exit(app.exec_())

Result

image

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqt-music-player-widget-0.0.31.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file pyqt-music-player-widget-0.0.31.tar.gz.

File metadata

File hashes

Hashes for pyqt-music-player-widget-0.0.31.tar.gz
Algorithm Hash digest
SHA256 26c2addafd55b59e908b06fe77ad12a6e00d02aab49804893815fe861a601630
MD5 5f87b3fa542b9960e616eb975a6f05e0
BLAKE2b-256 d2ac901c88798daf531a5e507190bf6c1fa38eddbceedce8a8d09e87a6d0ca10

See more details on using hashes here.

File details

Details for the file pyqt_music_player_widget-0.0.31-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqt_music_player_widget-0.0.31-py3-none-any.whl
Algorithm Hash digest
SHA256 023970e6a284719212d7c459be447f46d5a3409e783cdf117b3af83bb0d2778a
MD5 b3106cd71ba784e71561efb7fc89a4e4
BLAKE2b-256 1667e07854c876c3603a9a51998e0c0973325cf36cbd8541a382ab91197dfda5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page