-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathexpander_example.py
More file actions
47 lines (34 loc) · 1.17 KB
/
expander_example.py
File metadata and controls
47 lines (34 loc) · 1.17 KB
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
46
47
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
class ExpanderExample(Gtk.Window):
def __init__(self):
super().__init__(title="Expander Demo")
self.set_size_request(350, 100)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.add(vbox)
text_expander = Gtk.Expander(
label="This expander displays additional information"
)
text_expander.set_expanded(True)
vbox.add(text_expander)
msg = """
This message is quite long, complicated even:
- It has a list with a sublist:
- of 3 elements;
- taking several lines;
- with indentation.
"""
details = Gtk.Label(label=msg)
text_expander.add(details)
widget_expander = Gtk.Expander(label="Expand for more controls")
vbox.add(widget_expander)
expander_hbox = Gtk.HBox()
widget_expander.add(expander_hbox)
expander_hbox.add(Gtk.Label(label="Text message"))
expander_hbox.add(Gtk.Button(label="Click me"))
self.show_all()
win = ExpanderExample()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()