Как показать анимированный gif в приложении, которое я разрабатываю?

Резервные шрифты определяются Fontconfig; он консультируется с конфигурацией в /etc/fonts, а также с глифами, предоставляемыми всеми шрифтами, для определения или определения того, какой конкретный шрифт используется для предоставления символа. Вы можете щелкнуть правой кнопкой мыши по символу в Карте символов, чтобы увидеть, какой шрифт использовался для заполнения символа.

Новые версии карты символов GNOME могут ограничить отображение глифов определенным установленным шрифтом, но вы должны использовать что-то вроде FontForge для просмотра доступных глифов в компактном формате.

1
задан 23 June 2012 в 23:48

14 ответов

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 25 July 2018 в 18:21

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 2 August 2018 в 00:33

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 4 August 2018 в 16:03

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 6 August 2018 в 00:41

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 7 August 2018 в 18:06

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 10 August 2018 в 06:53

Поскольку вы добавили GTK к своему вопросу, пример и документация можно найти в учебнике PyGTK 2.0 в Глава 9. Разные виджеты .

Пример кода кода с использованием .gif для кнопок:

#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
    # when invoked (via signal delete_event), terminates the application.
    def close_application(self, widget, event, data=None):
        gtk.main_quit()
        return False

    # is invoked when the button is clicked.  It just prints a message.
    def button_clicked(self, widget, data=None):
        print "button %s clicked" % data

    def __init__(self):
        # create the main window, and attach delete_event signal to terminating
        # the application
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.connect("delete_event", self.close_application)
        window.set_border_width(10)
        window.show()

        # a horizontal box to hold the buttons
        hbox = gtk.HBox()
        hbox.show()
        window.add(hbox)

        pixbufanim = gtk.gdk.PixbufAnimation("goalie.gif")
        image = gtk.Image()
        image.set_from_animation(pixbufanim)
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "1")

        image = gtk.Image()
        image.set_from_file("soccerball.gif")
        image.show()
        # a button to contain the image widget
        button = gtk.Button()
        button.add(image)
        button.show()
        hbox.pack_start(button)
        button.connect("clicked", self.button_clicked, "2")


def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    ImagesExample()
    main()

ОРИГИНАЛЬНЫЙ ОТВЕТ

Вы можете использовать PyQt с виджемом QMovie () для воспроизведения анимированного gif. Ниже приведен пример, который я нашел ранее.

Пример из Python GUI Programming | Сайт DaniWeb :

# use PyQt's QMovie() widget to play an animated gif
# tested with PyQt4.4 and Python 2.5
# also tetsed with PyQt4.5 and Python 3.0
# vegaseat

import sys
# expect minimal namespace conflicts
from PyQt4.QtCore import *
from PyQt4.QtGui import * 

class MoviePlayer(QWidget):
    def __init__(self, parent=None): 

    QWidget.__init__(self, parent)
    # setGeometry(x_pos, y_pos, width, height)
    self.setGeometry(200, 200, 400, 300)
    self.setWindowTitle("QMovie to show animated gif")

    # set up the movie screen on a label
    self.movie_screen = QLabel()
    # expand and center the label
    self.movie_screen.setSizePolicy(QSizePolicy.Expanding,
    QSizePolicy.Expanding)
    self.movie_screen.setAlignment(Qt.AlignCenter) 

    main_layout = QVBoxLayout()
    main_layout.addWidget(self.movie_screen)
    self.setLayout(main_layout)

    # use an animated gif file you have in the working folder
    # or give the full file path
    movie = QMovie("AG_Dog.gif", QByteArray(), self)
    movie.setCacheMode(QMovie.CacheAll)
    movie.setSpeed(100)
    self.movie_screen.setMovie(movie)
    movie.start() 

app = QApplication(sys.argv)
player = MoviePlayer()
player.show()
sys.exit(app.exec_()) 
3
ответ дан 15 August 2018 в 18:50
  • 1
    Спасибо, но я предпочел бы остаться с Gtk, так как я уже начал использовать и изучать его. Вы отвечаете, вероятно, отлично для других людей. – Agmenor 23 June 2012 в 22:36
  • 2
    Вы не упомянули GTK раньше :) Просто добавив обновление в мой ответ с примером, ссылку на учебники и документацию. – Zuul 23 June 2012 в 22:53
  • 3
    Это сработало отлично. Спасибо за скрипт и за ссылку на учебник. – Agmenor 23 June 2012 в 23:06
  • 4
    Не могли бы вы дать мне дополнительную информацию о том, как это сделать с PyGObject, а не с PyGtk? Я сделал from gi.repository import Gdk, но пакет «PixbufAnimation» там нет. – Agmenor 23 June 2012 в 23:51
  • 5
    Конечно, вот ссылка на документацию и примеры , а также ссылку на Перенос PyGTK в PyGObject . – Zuul 24 June 2012 в 01:07

Это код, который я, наконец, написал, благодаря помощи Зуула. Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 25 May 2018 в 09:46

Это код, который я, наконец, написал, благодаря помощи Zuul . Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 25 July 2018 в 18:21

Это код, который я, наконец, написал, благодаря помощи Zuul . Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 2 August 2018 в 00:33

Это код, который я, наконец, написал, благодаря помощи Zuul . Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 4 August 2018 в 16:03

Это код, который я, наконец, написал, благодаря помощи Zuul . Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 7 August 2018 в 18:06

Это код, который я, наконец, написал, благодаря помощи Zuul . Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 10 August 2018 в 06:53

Это код, который я, наконец, написал, благодаря помощи Zuul . Это более специфично для PyGObject, инструмента, который используется в Quickly:

from gi.repository import Gtk, GdkPixbuf
#This is specific to my app Discvur developed in Quickly:
from discvur_lib.discvurconfig import get_data_file

[…]

    self.viewport = self.builder.get_object("viewport")
    path = get_data_file() + "/media/akO1i.gif"
    print path
    self.pixbufanim = GdkPixbuf.PixbufAnimation.new_from_file(path)
    print self.pixbufanim
    self.image = Gtk.Image()
    self.image.set_from_animation(self.pixbufanim)
    self.viewport.add(self.image)
    self.image.show()
0
ответ дан 15 August 2018 в 18:50

Другие вопросы по тегам:

Похожие вопросы: