Text Widget stupid question ? 
Author Message
 Text Widget stupid question ?

I can't anderstand why when I changes the font in a text widget then the
text widget resizes.

The code should be some thing like :

  set TextWidget [text .t]
  $TextWidget conf -font [ list $fo $si $st ]

I submit this question a week ago and get no answer.
Is it stupid ? (of course I'm a beginner)

Thanks for help

Christophe



Wed, 07 Mar 2001 03:00:00 GMT  
 Text Widget stupid question ?

Quote:

> I can't anderstand why when I changes the font in a text widget then the
> text widget resizes.

> The code should be some thing like :

>   set TextWidget [text .t]
>   $TextWidget conf -font [ list $fo $si $st ]

> I submit this question a week ago and get no answer.
> Is it stupid ? (of course I'm a beginner)

> Thanks for help

> Christophe

Text widget's width and height are measured in character units
(defaulted to 80 and 24).
So, if you change the font, you generally change the size-in-pixel
of your text widget.

Pascal



Wed, 07 Mar 2001 03:00:00 GMT  
 Text Widget stupid question ?
: I can't anderstand why when I changes the font in a text widget then the
: text widget resizes.

I saw answer to your question in another thread just today.

: The code should be some thing like :

:   set TextWidget [text .t]
:   $TextWidget conf -font [ list $fo $si $st ]

: I submit this question a week ago and get no answer.
: Is it stupid ? (of course I'm a beginner)

Becouse when you specify width and height of widgets, you use
"average symbols" units. You didn't specify any size, but it defaults
to -width 80 -height 24.

If you change font size, widget resizes to fit 80x24 characters with
new font.
What to do?

I think - just ignore resizing.
If you absolutely need to have constant-size widget with changable font,
you have to use font metrics command to compute average charsize of font
and always specify new width and height along with font.
Thus you restrict widget size changes to be less then one charsize.

Small tricks with geometry manager will let you to hide this size
changes.

: Thanks for help

: Christophe

--
--------------------------------------------------------
I have tin news and pine mail...



Fri, 09 Mar 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Some questions on elided text in the text widget (and a few other text widget questions)

2. Question: How to hide text in text-widgets

3. nroff formated texts in Tk text widget (this is not a question, this is the answer)

4. Stupid question about DUIM/widgets

5. Stupid (very) question about menu Widget

6. embedding text widgets in other text widgets

7. Ruby/Gtk, Text widget question

8. IDLE/Tk Text widget question

9. Tk Text Widget question

10. Tkinter text widget question

11. Tkinter question - proper output in Text widget

12. Questions about geometry managers and about marks in text widgets

 

 
Powered by phpBB® Forum Software