Question about Text Widgets 
Author Message
 Question about Text Widgets

As a new Tk user, I've read through everything that I can find(which
probably isn't even close to all the documentation available), and can't
find a real solution, which is probably quite simple.  I want to have a
text widget that will display some instructions, without a user having the
ability to modify the text.  So, essentially, I want the text widget to
act like a large label.  I tried the following:

$fpga_instructions = $control_fr->Text(-relief => 'flat', -state =>
'disabled' -height => 4,) ->pack(-side => 'top', -fill => 'x');

$fpga_instructions->insert('1.0', "This is a test.");

I originally thought that setting the 'State' to 'disabled', would give me
the functionality that I want.  Then I read in the documentation that it
doesn't allow ANY modifications to the text widget, including my insert
command.

Is there a way to do this?  Or should I create one big label?  The only
issue there is possible format problems -- which I can work through if
need be.

Thanks,

Jon Turenne

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jonathan P. Turenne      Main Phone : (978) 692-2600
Lucent Technologies      Direct Line: (978) 952-7736
EDA Tools Group          Fax:         (978) 692-1983


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Sun, 22 Jun 2003 05:55:00 GMT  
 Question about Text Widgets

Quote:

> As a new Tk user, I've read through everything that I can find(which
> probably isn't even close to all the documentation available), and can't
> find a real solution, which is probably quite simple.  I want to have a
> text widget that will display some instructions, without a user having the
> ability to modify the text.  So, essentially, I want the text widget to
> act like a large label.  I tried the following:

> $fpga_instructions = $control_fr->Text(-relief => 'flat', -state =>
> 'disabled' -height => 4,) ->pack(-side => 'top', -fill => 'x');

> $fpga_instructions->insert('1.0', "This is a test.");

> I originally thought that setting the 'State' to 'disabled', would give me
> the functionality that I want.  Then I read in the documentation that it
> doesn't allow ANY modifications to the text widget, including my insert
> command.

> Is there a way to do this?  Or should I create one big label?  The only
> issue there is possible format problems -- which I can work through if
> need be.

1) You would disable the widget after inserting all your text.

2) Use a Tk::ROText widget instead - the preferred method.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Sun, 22 Jun 2003 06:42:13 GMT  
 Question about Text Widgets
Just:

use ROText;

instead..

Jack

Quote:
-----Original Message-----

Sent: January 2, 2001 2:12 PM
To: Perl/TK NewsGroup
Subject: Question about Text Widgets

As a new Tk user, I've read through everything that I can find(which
probably isn't even close to all the documentation available), and can't
find a real solution, which is probably quite simple.  I want to have a
text widget that will display some instructions, without a user having the
ability to modify the text.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the




Sun, 22 Jun 2003 06:47:17 GMT  
 Question about Text Widgets
use the ROText widget.

Mark Lakata
MIPS Technologies      
1225 Charleston Road  
Mountain View, CA 94043
phone 650-567-5170
fax   650-567-5002

Quote:

> As a new Tk user, I've read through everything that I can find(which
> probably isn't even close to all the documentation available), and can't
> find a real solution, which is probably quite simple.  I want to have a
> text widget that will display some instructions, without a user having the
> ability to modify the text.  So, essentially, I want the text widget to
> act like a large label.  I tried the following:

> $fpga_instructions = $control_fr->Text(-relief => 'flat', -state =>
> 'disabled' -height => 4,) ->pack(-side => 'top', -fill => 'x');

> $fpga_instructions->insert('1.0', "This is a test.");

> I originally thought that setting the 'State' to 'disabled', would give me
> the functionality that I want.  Then I read in the documentation that it
> doesn't allow ANY modifications to the text widget, including my insert
> command.

> Is there a way to do this?  Or should I create one big label?  The only
> issue there is possible format problems -- which I can work through if
> need be.

> Thanks,

> Jon Turenne

> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Jonathan P. Turenne      Main Phone : (978) 692-2600
> Lucent Technologies      Direct Line: (978) 952-7736
> EDA Tools Group          Fax:         (978) 692-1983


> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> -++**==--++**==--++**==--++**==--++**==--++**==--++**==
> This message was posted through the Stanford campus mailing list
> server.  If you wish to unsubscribe from this mailing list, send the


-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Sun, 22 Jun 2003 07:02:38 GMT  
 Question about Text Widgets

Quote:
----- Original Message -----

> I want to have a
> text widget that will display some instructions, without a user having the
> ability to modify the text.  So, essentially, I want the text widget to
> act like a large label.

Use ROText (ReadOnlyText)

    Best regards
    Jesper Naur

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the



Sun, 22 Jun 2003 07:05:45 GMT  
 Question about Text Widgets

[...]

Quote:
> $fpga_instructions->insert('1.0', "This is a test.");

> I originally thought that setting the 'State' to 'disabled', would give me
> the functionality that I want.  Then I read in the documentation that it
> doesn't allow ANY modifications to the text widget, including my insert
> command.

If you really don't want to use ROText, you could do it this way:

$f = $c->Text->pack;
$f->insert('0.0', "no kangaroos in austria");
$f->configure(-state => 'disabled');

HTH, Johannes



Sun, 22 Jun 2003 08:59:37 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Simple question: Saving text widgets text

2. Question on Text Widget Update

3. Question on Text Widget Update

4. Perl/Tk Questions About Text Widget

5. Question on Text Widget Update

6. Listbox and Text widget questions

7. Text Widget Scroll Design Question

8. Another text widget question

9. Basic Text Widget Question

10. Text Widget Question

11. [Re: Tk Text Widget Question]

12. Tk Text Widget Question

 

 
Powered by phpBB® Forum Software