Tkinter Listbox string formatting question - how to kill a dancing snake ?
- From: "Hendrik van Rooyen" <mail@xxxxxxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 09:33:55 +0200
I am populating a listbox from a directory that looks like this:
variable_dict = {"funny_long_or_short_variable_name_as_key": (2,45),......
the tuple represents a "card, line" pair.
medf is a font object and a forward reference here.
I write:
for x in variable_dict:
txt = x
while medf.measure(txt) < 350:
txt = txt + ' '
txt = txt + str(variable_dict[x])
and I use the txt string to populate the list box.
At first glance, it seems to work, as the names are on the left, and the tuples
are in a column...
But if you scroll the listbox, the inherent error makes it appear as if the
tuple column is a snake doing the twist.
I tried using a tab but got a backslash - t in the text, and simply counting
spaces is worse than useless.
Is there a way to format this so it will line up with *any* font ?
I would prefer not to give up and use a fixed width font - it looks so
teletypish...
A blank char of one pixel width would sort this nicely - but as the hilbilly
said when he first saw a rhinoceros: " There aint no such animal! " - or is
there?
- Hendrik
.
- Prev by Date: Re: make a simple search function for homepage
- Next by Date: Re: Event driven server that wastes CPU when threaded doesn't
- Previous by thread: make a simple search function for homepage
- Next by thread: Re: Tkinter Listbox string formatting question - how to kill a dancing snake ?
- Index(es):
Relevant Pages
|