logo

scripts

A bunch of scripts, some to be moved to their own repository git clone https://anongit.hacktivis.me/git/scripts.git/

image.py (910B)


  1. #!/usr/bin/env python
  2. import gtk
  3. window = gtk.Window()
  4. window.set_default_size(640, 480)
  5. window.set_title("Image Viewer")
  6. class Image:
  7. def __init__(self):
  8. vbox = gtk.VBox(False, 5)
  9. scrolledwindow = gtk.ScrolledWindow()
  10. self.image = gtk.Image()
  11. self.button = gtk.FileChooserButton("Select Image", None)
  12. self.button.connect("file-set", self.load_image)
  13. window.add(vbox)
  14. vbox.pack_start(self.button, False, False, 0)
  15. vbox.pack_start(scrolledwindow, True, True, 0)
  16. scrolledwindow.add_with_viewport(self.image)
  17. window.show_all()
  18. def load_image(self, widget):
  19. self.image.set_from_file(self.button.get_filename())
  20. window.set_title("Image Viewer - " + self.button.get_filename())
  21. window.set_icon_from_file(self.button.get_filename())
  22. Image()
  23. gtk.main()