import sys
from PyQt4 import QtGui, QtCore
class Player(QtGui.QMainWindow):
def __init__(self, master=None):
QtGui.QMainWindow.__init__(self, master)
self.createUI()
def mouseDoubleClickEvent(self, event):
# do whatever the normal double click would do
super(Player, self).mouseDoubleClickEvent(event)
# and also tack on our own extra behavior
if self.isFullScreen():
self.showNormal()
else:
self.showFullScreen()
def createUI(self):
self.Widget = QtGui.QWidget(self)
self.setCentralWidget(self.Widget)
self.VideoFrame = QtGui.QFrame()
self.Palette = self.VideoFrame.palette()
self.Palette.setColor (QtGui.QPalette.Window,
QtGui.QColor(0,0,0))
self.VideoFrame.setPalette(self.Palette)
self.VideoFrame.setAutoFillBackground(True)
self.PositionSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
self.PositionSlider.setToolTip("Position")
self.PositionSlider.setMaximum(1000)
self.HButtonBox = QtGui.QHBoxLayout()
self.PlayButton = QtGui.QPushButton("Play")
self.HButtonBox.addWidget(self.PlayButton)
self.StopButton = QtGui.QPushButton("Stop")
self.HButtonBox.addWidget(self.StopButton)
self.HButtonBox.addStretch(1)
self.VolumeSlider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
self.VolumeSlider.setMaximum(100)
self.VolumeSlider.setToolTip("Volume")
self.HButtonBox.addWidget(self.VolumeSlider)
self.VBoxLayout = QtGui.QVBoxLayout()
self.VBoxLayout.addWidget(self.VideoFrame)
self.VBoxLayout.addWidget(self.PositionSlider)
self.VBoxLayout.addLayout(self.HButtonBox)
self.Widget.setLayout(self.VBoxLayout)
if __name__ == "__main__":
QtGui.QApplication.setStyle(\'macintosh\')
app = QtGui.QApplication(sys.argv)
MediaPlayer = Player()
MediaPlayer.show()
MediaPlayer.resize(640, 480)
sys.exit(app.exec_())