473,394 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Listbox fill=BOTH expand=YES (Tkinter)

I am trying the following:

Listbox(parent).pack(fill=BOTH, expand=YES)

I notice that the listbox will fill on the X axis but will not on the Y
axis unlike other widgets. Is there any way to force this?

thanks,

Harlin

Jul 18 '05 #1
9 3947
Harlin Seritt wrote:
I am trying the following:

Listbox(parent).pack(fill=BOTH, expand=YES)

I notice that the listbox will fill on the X axis but will not on the Y
axis unlike other widgets. Is there any way to force this?

thanks,

Harlin


Harlin,

It should expand (and fill ) in both directions have you checked it's
parents packing options?

Martin

Jul 18 '05 #2
That was it Martin. I forgot to expand the parent.

Thanks!

Jul 18 '05 #3
"Martin Franklin" wrote:
Harlin Seritt wrote:
I am trying the following:

Listbox(parent).pack(fill=BOTH, expand=YES)

I notice that the listbox will fill on the X axis but will not on
the Y axis unlike other widgets.
Is there any way to force this?

thanks,

Harlin


Harlin,

It should expand (and fill ) in both directions have you checked
it's parents packing options?

Martin


is YES a valid flag for expand?
maybe expand=1

--
nirinA
Jul 18 '05 #4
either YES, True, or 1 should work.

Jul 18 '05 #5
"Harlin Seritt" wrote:
either YES, True, or 1 should work.


yes, indeed.
import Tkconstants
'True' and 'YES' in dir(Tkconstants)

True

thanks Harlin,

--
nirinA
Jul 18 '05 #6
On Tue, 15 Mar 2005 16:48:17 +0300, rumours say that "Raseliarison nirinA"
<ni****@mail.blueline.mg> might have written:
yes, indeed.
import Tkconstants
'True' and 'YES' in dir(Tkconstants)

True

thanks Harlin,


I hope you also know that

..>> 'inexistent keyword' and 'YES' in dir(Tkconstants)

is also True...
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
Jul 18 '05 #7
"Christos TZOTZIOY Georgiou" wrote:
On Tue, 15 Mar 2005 16:48:17 +0300,
rumours say that [i] might have written:
yes, indeed.
> import Tkconstants
> 'True' and 'YES' in dir(Tkconstants)

True

thanks Harlin,


I hope you also know that

.>> 'inexistent keyword' and 'YES' in dir(Tkconstants)

is also True...


yeah, known but forgotten.

hmmm .......
let's try :
import Tkconstants
'YES' in dir(Tkconstants) True 'True' in dir(Tkconstants) False 'TRUE' in dir(Tkconstants) True ('inexistent keyword') in dir(Tkconstants) False

so 'TRUE' and 'YES' in dir(Tkconstants) True 'inexistent keyword' and 'YES' in dir(Tkconstants) True

i'll recite 42 times truth tables before going to bed.
however i didn't expect the following:
'inexistent keyword' or 'YES' in dir(Tkconstants) 'inexistent keyword' False or 'YES' in dir(Tkconstants) True

hmmm...
('inexistent keyword' or 'YES') in dir(Tkconstants) False (False or 'YES') in dir(Tkconstants) True

i'll recite 42 times precedence rules before going to bed.
but now i'm a bit confused by the -in- operator. as:
set(['TRUE','YES']).issubset(set(dir(Tkconstants))) True

i expected this to be true, but it's not:
set(['TRUE','YES']) in set(dir(Tkconstants)) False

originaly, i'm thinking to short-cut the following, reduce(lambda t,f: t and f, [i in dir(Tkconstants) for i in 'YES','inexistent keyword'])
False reduce(lambda t,f: t and f, [i in dir(Tkconstants) for i in

'TRUE','YES'])
True

but that was too short and i miss something!
i do reset my brain somewhere between cell234 and cell241
thanks for reading!

--
nirinA
--
Jul 18 '05 #8
On Thu, 17 Mar 2005 00:54:46 +0300, rumours say that "Raseliarison nirinA"
<ni****@mail.blueline.mg> might have written:
i'll recite 42 times precedence rules before going to bed.
but now i'm a bit confused by the -in- operator. as:
>>> set(['TRUE','YES']).issubset(set(dir(Tkconstants))) True i expected this to be true, but it's not:
>>> set(['TRUE','YES']) in set(dir(Tkconstants))

False


the 'in' operator searches for existance of *elements* in a set, not of
*subsets*. BTW, only a frozenset can be included in a set.

To check for subsets, either use the issubset function, or the '<' operator (I
believe they both call the same code):

..>> set(['TRUE','YES']).issubset(set(dir(Tkconstants)))
True

can be expressed as

..>> set(['TRUE','YES']) < set(dir(Tkconstants))
True
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
Jul 18 '05 #9
"Christos TZOTZIOY Georgiou" wrote:

the 'in' operator searches for existance of *elements* in a set, not
of *subsets*. BTW, only a frozenset can be included in a set.
ah! yes. that's clear now. thanks!
after all:
for element in aset: print element,

why did i think that 'in' was another different operator?
the test should be then:
'TRUE' in dir(Tkconstants) and 'YES' in dir(Tkconstants) True

and then:
'inexistent keyword' in dir(Tkconstants) and 'YES' in dir(Tkconstants)
False

a bit cumbersome if there is a lot of keys to test.
i also found in the itertools-recipes the way to avoid
the reduce-lambda construction i had previously in head:
from itertools import *
def all(seq, pred=bool): "Returns True if pred(x) is True for every element in the
iterable"
for elem in ifilterfalse(pred, seq):
return False
return True
all(i in dir(Tkconstants) for i in ['TRUE', 'YES']) True all(i in dir(Tkconstants) for i in ['TRUE', 'YES', 'inexistent

key'])
False

lovely...
i do not regret the fate of reduce et al.

To check for subsets, either use the issubset function, or the '<' operator (I believe they both call the same code):

.>> set(['TRUE','YES']).issubset(set(dir(Tkconstants)))
True

can be expressed as

.>> set(['TRUE','YES']) < set(dir(Tkconstants))
True


i noted! thanks again.

--
nirinA
--

Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas Nücker | last post by:
Hi! I am creating a dialog-box within my application, using tkinter. The problem is the following: After the dialogbox is started, the main application window comes again to top and the...
2
by: Frank Stajano | last post by:
The compact form of pack behaves differently (and I believe incorrectly) compared to the long form. The following two scripts demonstrate it, at least on this interpreter: Python 2.3.2 (#1, Oct 9...
2
by: Maboroshi | last post by:
Why when I use the sticky command with the grid layout manager won't my Listbox expand it stays in the center maybe I am missing something but from every tutorial I see it says to do it this way ...
1
by: Pekka Niiranen | last post by:
Hi there, after reading TkInter/thread -recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 I wondered if it was possible to avoid using threads for the following problem: ...
3
by: Harlin Seritt | last post by:
I've created a ghetto-ized ComboBox that should work nicely for Tkinter (unfortunately no dropdown capabilities yet). I've found why it's such a pain in the @ss to create one. You have to...
8
by: James Stroud | last post by:
Hello All, I would like for a tkinter text widget to be aware of how big the frame that contains it is, then I would like for it to reset its width to the appropriate number of characters when...
1
by: syed_saqib_ali | last post by:
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
4
by: Simon Forman | last post by:
Hi all, I realize this is more of a Tk question than a python one, but since I'm using python and don't know Tcl/Tk I figured I'd ask here first before bugging the Tcl folks. I am having a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.