python3 + gtk3 image sequence - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: python3 + gtk3 image sequence (/thread-3013.html) |
python3 + gtk3 image sequence - changos - Apr-24-2017 Hello, I tried to show some images in a sequence, when click a button show the first image and after one second show the next image, I tried the next code, but only show me the last image. #!/usr/bin/python3 import os import time import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk class GridWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="NEOTECH") self.grid = Gtk.Grid() self.add(self.grid) self.btnStartTest=Gtk.Button("Iniciar Prueba") self.btnStartTest.connect("clicked",self.StartTest) self.image = Gtk.Image() self.image.set_from_file("logo-NeoTech.png") self.grid.add(self.btnStartTest) self.grid.attach(self.image,0,1,1,1) def StartTest(self,widget): self.image.set_from_file("gato3.jpg") time.sleep(2) self.image.set_from_file("gato4.jpg") print("fin") win = GridWindow() win.set_position(Gtk.WindowPosition.CENTER) win.set_default_size(1000,480) win.set_type_hint(Gdk.WindowTypeHint.MENU) win.connect("delete-event", Gtk.main_quit) win.show_all() Gtk.main() |