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


Groups > comp.lang.python > #18128 > unrolled thread

pls explain this flags use

Started byTracubik <affdfsdfdsfsd@b.com>
First post2011-12-28 17:16 +0000
Last post2011-12-28 10:56 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  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

#18128 — pls explain this flags use

FromTracubik <affdfsdfdsfsd@b.com>
Date2011-12-28 17:16 +0000
Subjectpls explain this flags use
Message-ID<4efb4f00$0$1393$4fafbaef@reader1.news.tin.it>
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?

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

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?

i'm new at this sintassi so i'm trying to guess on my own, pls feel free 
to tell me if i'm wrong and where

thanks and best wishes
Medeo

[toc] | [next] | [standalone]


#18132

FromIan Kelly <ian.g.kelly@gmail.com>
Date2011-12-28 10:56 -0700
Message-ID<mailman.4188.1325095051.27778.python-list@python.org>
In reply to#18128
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web