diff options
author | Cristian Garcia <cristian99garcia@gmail.com> | 2013-05-07 18:19:05 (GMT) |
---|---|---|
committer | Cristian Garcia <cristian99garcia@gmail.com> | 2013-05-07 18:19:05 (GMT) |
commit | a8e0f14a7cb60d946bc0025e1580163d7fe965a9 (patch) | |
tree | dfb520ed57a22bd73fc17ee36ff26f74551ec34e | |
parent | 7da3b5bd2a3daaa9128d0a8ea7c7e4f129ea138e (diff) |
Creando Box2.py
-rw-r--r-- | Box2.py | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# IconView.py by: +# Cristian García <cristian99garcia@gmail.com> +# Ignacio Rodríguez <nachoel01@gmail.com> +# Python Joven - CeibalJAM! Uruguay + +from IconView import IconView +from ListView import ListView + +from gi.repository import Gtk + +class Box2(Gtk.Box): + + def __init__(self): + Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) + + self.iconview = IconView() + self.listview = ListView() + self.view = self.iconview + + self.scrolled = Gtk.ScrolledWindow() + + self.scrolled.add(self.view) + + self.pack_start(self.scrolled, True, True, 4) + + def cambiar_view(self, view): + if view == 'iconos': + self.view = self.iconview + + else: + self.view = self.listview + + self.scrolled.remove(self.scrolled.get_children()[0]) + self.scrolled.add(self.view) + + self.show_all() + +if __name__ == '__main__': + Ventana = Gtk.Window() + Ventana.connect("delete-event", lambda x, i: exit()) + Ventana.add(Box2()) + Ventana.show_all() + Gtk.main() |