Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18132

Re: pls explain this flags use

References <4efb4f00$0$1393$4fafbaef@reader1.news.tin.it>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-12-28 10:56 -0700
Subject Re: pls explain this flags use
Newsgroups comp.lang.python
Message-ID <mailman.4188.1325095051.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Dec 28, 2011 at 10:16 AM, Tracubik <affdfsdfdsfsd@b.com> wrote:
> Hi all,
> i've found here (http://python-gtk-3-tutorial.readthedocs.org/en/latest/
> layout.html#table) this code:
>
> [quote]
> If omitted, xoptions and yoptions defaults to
> Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL.
> [end quote]
>
> xoptions have 3 flags: EXPAND, FILL, SHRINK
>
> so, how it is supposed to work?
> it means that by default xoptions is set to EXPAND true, FILL true,
> SHRINK false?

Yes.

> how it work? "|" is used with bits afaik, so i suppouse the xoptions is 3
> bits?

Yes.

> and the default is
> EXPAND FILL SHRINK
>  1      1     0
>
> (or something similar)
>
> so i have
>
> AttachOptions.EXPAND = 100
> AttachOptions.FILL   = 010
>
> EXPAND|FILL = 100|010 = 110
>
> is that right?
> so if i want EXPAND *and* FILL i have to make EXPAND *binary or* FILL?

Yes.  Binary or is used to set flags, binary and is used to test
whether specific flags are set, e.g.:

if options & AttachOptions.EXPAND:
    # do something expandy
else:
    # do something not expandy

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

pls explain this flags use Tracubik <affdfsdfdsfsd@b.com> - 2011-12-28 17:16 +0000
  Re: pls explain this flags use Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-28 10:56 -0700

csiph-web