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


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

fill, expand from tkinter.pack() layout manager

Started by"ast" <nomail@invalid.com>
First post2014-11-04 15:16 +0100
Last post2014-11-04 06:42 -0800
Articles 3 — 2 participants

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


Contents

  fill, expand from tkinter.pack() layout manager "ast" <nomail@invalid.com> - 2014-11-04 15:16 +0100
    Re: fill, expand from tkinter.pack() layout manager "ast" <nomail@invalid.com> - 2014-11-04 15:41 +0100
    Re: fill, expand from tkinter.pack() layout manager Fatih Güven <mfthguven@gmail.com> - 2014-11-04 06:42 -0800

#80184 — fill, expand from tkinter.pack() layout manager

From"ast" <nomail@invalid.com>
Date2014-11-04 15:16 +0100
Subjectfill, expand from tkinter.pack() layout manager
Message-ID<5458dfc6$0$27505$426a74cc@news.free.fr>
Hi

I dont really understood how "fill" and "expand"
works with  layout manager tkinter.pack()

Example:

from tkinter import *
root = Tk()
w = Label(root, text="Red", bg="red", fg="white")
w.pack(side=LEFT, fill = BOTH)

Here is the result:
http://cjoint.com/?0Kepj1E3Tv3

Why is the label "w" only extended vertically and not horizontally too ?
I specified "fill = BOTH" so it should extend in both direction.

(I know that with expand = 1, it will expand in both direction) 

thx

[toc] | [next] | [standalone]


#80186

From"ast" <nomail@invalid.com>
Date2014-11-04 15:41 +0100
Message-ID<5458e5b2$0$2929$426a74cc@news.free.fr>
In reply to#80184
"ast" <nomail@invalid.com> a écrit dans le message de news:5458dfc6$0$27505$426a74cc@news.free.fr...

> w.pack(side=LEFT, fill = BOTH)
> Why is the label "w" only extended vertically and not horizontally too ?

with:
w.pack(side=TOP, fill = BOTH)

it expand horizontally but not vertically

with:
w.pack(side=LEFT, fill = BOTH, expand = 1) or
w.pack(side=TOP, fill = BOTH, expand = 1)

it expand both horizontally and vertically

[toc] | [prev] | [next] | [standalone]


#80187

FromFatih Güven <mfthguven@gmail.com>
Date2014-11-04 06:42 -0800
Message-ID<e77adb0b-6883-4420-92aa-29c4419d910e@googlegroups.com>
In reply to#80184
4 Kasım 2014 Salı 16:16:52 UTC+2 tarihinde ast yazdı:
> Hi
> 
> I dont really understood how "fill" and "expand"
> works with  layout manager tkinter.pack()
> 
> Example:
> 
> from tkinter import *
> root = Tk()
> w = Label(root, text="Red", bg="red", fg="white")
> w.pack(side=LEFT, fill = BOTH)
> 
> Here is the result:
> http://cjoint.com/?0Kepj1E3Tv3
> 
> Why is the label "w" only extended vertically and not horizontally too ?
> I specified "fill = BOTH" so it should extend in both direction.
> 
> (I know that with expand = 1, it will expand in both direction) 
> 
> thx

Hi,

Packing widgets splits frame into equal areas with expand=1. if expand="false", widgets don't touch each other and widgets save their own dimension.

[toc] | [prev] | [standalone]


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


csiph-web