File indexing completed on 2025-01-12 05:02:30

0001 #!/usr/bin/env python3
0002 
0003 # SPDX-FileCopyrightText: 2024 Fushan Wen <qydwhotmail@gmail.com>
0004 # SPDX-License-Identifier: MIT
0005 
0006 import os
0007 
0008 import gi
0009 
0010 gi.require_version('GdkPixbuf', '2.0')
0011 gi.require_version('Gtk', '3.0')
0012 from gi.repository import GdkPixbuf, GLib, Gtk
0013 
0014 win = None
0015 current_index = 0
0016 icon_1 = GdkPixbuf.Pixbuf.new_from_file(os.path.join(os.path.dirname(os.path.abspath(__file__)), "none.png"))
0017 icon_2 = GdkPixbuf.Pixbuf.new_from_file(os.path.join(os.path.dirname(os.path.abspath(__file__)), "samplewidgetwindow.png"))
0018 
0019 
0020 def change_icon():
0021     global current_index
0022     if current_index == 0:
0023         win.set_icon(icon_1)
0024         current_index = 1
0025     else:
0026         win.set_icon(icon_2)
0027         current_index = 0
0028 
0029     return True
0030 
0031 
0032 if __name__ == "__main__":
0033     win = Gtk.Window(title="flash")
0034     win.show_all()
0035     GLib.timeout_add(100, change_icon)
0036     GLib.timeout_add_seconds(60, Gtk.main_quit)
0037     Gtk.main()