blob: cf0d62ca9eb180545bec323c9cc66d0ca7092467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()
|