Re: Tkinter label height to fit content

2011-09-06 Thread Bart Kastermans
rantingrick writes: > On Sep 6, 5:00 pm, Bart Kastermans wrote: >> rantingrick writes: >> > Hmm, i can replace all that code with this... >> >> Because I stupidly forgot to repeat the original problem I had, and my >> code doesn't show it (and doesn't show the correct use of the function I >> w

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
On Sep 6, 5:40 pm, rantingrick wrote: > On Sep 6, 5:00 pm, Bart Kastermans wrote: > Take your input data and replace ALL single newlines with null strings CORRECTION: Take your input data and replace ALL single newlines with A SINGLE SPACE -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
On Sep 6, 5:00 pm, Bart Kastermans wrote: > rantingrick writes: > > Hmm, i can replace all that code with this... > > Because I stupidly forgot to repeat the original problem I had, and my > code doesn't show it (and doesn't show the correct use of the function I > wrote). Oh NOW i see! This new

Re: Tkinter label height to fit content

2011-09-06 Thread Bart Kastermans
rantingrick writes: > Hmm, i can replace all that code with this... Because I stupidly forgot to repeat the original problem I had, and my code doesn't show it (and doesn't show the correct use of the function I wrote). The code shows that I now know how to compute the number of lines and item

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
Or if you prefer the alternating background approach... ## # Easy_as.py ## import Tkinter as tk from ScrolledText import ScrolledText import tkFont import random END = 'end' INSERT = 'insert' # # Create some puesdo data. data = [ '{0}.{1}'.format(x, 'blah'*rand

Re: Tkinter label height to fit content

2011-09-06 Thread rantingrick
Hmm, i can replace all that code with this... # # Easy_as.py # import Tkinter as tk from ScrolledText import ScrolledText import tkFont import random # Create some puesdo data. data = [ '{0}.{1}'.format(x, 'blah'*random.randint(4, 50)) for x in range(100) ] ##print data # Create the ma

Re: Tkinter label height to fit content

2011-09-06 Thread Bart Kastermans
I build on the suggestion by rantingrick, but took it in a bit different direction. I now have working code that performs reasonable. The reason for the class lines (as opposed to just a function) is b/c font.measure appears not that fast. So I want to remember between different calls to lines.

Re: Tkinter label height to fit content

2011-09-04 Thread rantingrick
On Sep 4, 2:39 pm, Bart Kastermans wrote: > Thx.  That function should allow for a bit of robustness. Correction. The function is actually "tkFont.metrics(arg)" which takes "linespace" as an optional argument. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter label height to fit content

2011-09-04 Thread rantingrick
On Sep 4, 2:39 pm, Bart Kastermans wrote: > I get bits of information over RSS, these are of varying length.  I > want to show 10 at a time, and scroll through them.  Now when I > scroll the window grows and shrinks depending on their size, I want > to right from the start make it high enough to

Re: Tkinter label height to fit content

2011-09-04 Thread Bart Kastermans
rantingrick writes: > On Sep 3, 5:15 pm, Bart Kastermans wrote: > >> Any suggestions? > > Yeah, have you considered using the "linespace()" method of tk.Font > objects to calculate the height? Although i must say it "feels" as if > your doing something you should not need to do, however i cannot

Re: Tkinter label height to fit content

2011-09-03 Thread rantingrick
On Sep 3, 5:15 pm, Bart Kastermans wrote: > Any suggestions? Yeah, have you considered using the "linespace()" method of tk.Font objects to calculate the height? Although i must say it "feels" as if your doing something you should not need to do, however i cannot be sure without knowing more abo