blob: 0a90735f0e8fc1846051dbfae04add3cecd238ed (
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
|
=============
Flags & Enums
=============
Flags are subclasses of :class:`GObject.GFlags` and represent bit fields where
some bits also have names:
.. code:: pycon
>>> Gtk.DialogFlags.MODAL
<flags GTK_DIALOG_MODAL of type Gtk.DialogFlags>
>>> Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT
<flags GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT of type Gtk.DialogFlags>
>>> int(_)
3
>>> Gtk.DialogFlags(3)
<flags GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT of type Gtk.DialogFlags>
>>> isinstance(Gtk.DialogFlags.MODAL, Gtk.DialogFlags)
True
>>>
Bitwise operations on them will produce a value of the same type.
Enums are subclasses of :class:`GObject.GEnum` and represent a list of named
constants:
.. code:: pycon
>>> Gtk.Align.CENTER
<enum GTK_ALIGN_CENTER of type Gtk.Align>
>>> int(Gtk.Align.CENTER)
3
>>> int(Gtk.Align.END)
2
>>> Gtk.Align(1)
<enum GTK_ALIGN_START of type Gtk.Align>
>>> isinstance(Gtk.Align.CENTER, Gtk.Align)
True
|