当前位置: 首页>>代码示例>>Python>>正文


Python QMovie.scaledSize方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QMovie.scaledSize方法的典型用法代码示例。如果您正苦于以下问题:Python QMovie.scaledSize方法的具体用法?Python QMovie.scaledSize怎么用?Python QMovie.scaledSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QMovie的用法示例。


在下文中一共展示了QMovie.scaledSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ImagePlayer

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import scaledSize [as 别名]
class ImagePlayer(QWidget):
    def __init__(self, filename, title, parent=None):
        QWidget.__init__(self, parent)

        # Load the file into a QMovie
        self.movie = QMovie(filename, QByteArray(), self)

        size = self.movie.scaledSize()
        self.setGeometry(200, 200, size.width(), size.height())
        self.setWindowTitle(title)

        self.movie_screen = QLabel()
        # Make label fit the gif
        self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.movie_screen.setAlignment(Qt.AlignCenter)

        # Create the layout
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.movie_screen)

        self.setLayout(main_layout)

        # Add the QMovie object to the label
        self.movie.setCacheMode(QMovie.CacheAll)
        self.movie.setSpeed(100)
        self.movie_screen.setMovie(self.movie)
        self.movie.start()
开发者ID:evil-is-good,项目名称:primat-projects,代码行数:29,代码来源:3.py

示例2: ImagePlayer

# 需要导入模块: from PyQt4.QtGui import QMovie [as 别名]
# 或者: from PyQt4.QtGui.QMovie import scaledSize [as 别名]
class ImagePlayer(QWidget):
    def __init__(self, filename, title, parent=None):
        QWidget.__init__(self, parent)
 
        # Load the file into a QMovie
        self.movie = QMovie(filename, QByteArray(), self)
        print(filename)
 
        size = self.movie.scaledSize()
        self.setGeometry(200, 200, size.width(), size.height())
        self.setWindowTitle(title)
 
        self.movie_screen = QLabel()
        # Make label fit the gif
        self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.movie_screen.setAlignment(Qt.AlignCenter)
        self.btn_ex = QPushButton()
        self.btn_ex.setFixedWidth(100)
        self.btn_ex.setFixedHeight(100)
        # self.btn_ex.setIcon(QIcon("image/ex_stu.gif"))
        self.btn_ex.setStyleSheet("background-color: rgba(255,255,255,20);")
        self.btn_ex.setIcon(QIcon("image/smile.png"))
        self.btn_ex.setIconSize(QSize(80,80))
        self.btn_ex.setFlat(True)

        popMenu = QMenu(self)
        entry1 = popMenu.addAction("正确")
        # self.connect(entry1,SIGNAL('triggered()'), lambda item=item[0]: self.answerRight(item))
        entry2 = popMenu.addAction("错误")
        # self.connect(entry2,SIGNAL('triggered()'), lambda item=item[0]: self.answerWrong(item))
        entry3 = popMenu.addAction("替换")
        # self.connect(entry3,SIGNAL('triggered()'), lambda item=item[0]: self.resetStudent(item))
        self.btn_ex.setMenu(popMenu)


 
        # Create the layout
        main_layout = QVBoxLayout()
        main_layout.addWidget(self.movie_screen)
        # main_layout.addWidget(self.btn_ex)
 
        self.setLayout(main_layout)
 
        # Add the QMovie object to the label
        self.movie.setCacheMode(QMovie.CacheAll)
        # self.movie.setSpeed(100)
        self.movie_screen.setMovie(self.movie)
        self.movie_screen.setLayout(QHBoxLayout())
        self.movie_screen.layout().addWidget(self.btn_ex)

        popMenu = QMenu(self)
        entry1 = popMenu.addAction("正确")
        # self.movie_screen.setMenu(popMenu)

        self.movie.start()
开发者ID:iefan,项目名称:randstudent,代码行数:57,代码来源:ex11_gif.py


注:本文中的PyQt4.QtGui.QMovie.scaledSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。