[Tkinter-discuss] how to get all the text from a text widget?

Snakey darr_low at yahoo.com
Thu May 15 02:12:52 CEST 2008


Hi Polo,

Thanks for the tip!



Guilherme Polo wrote:
> 
> Snakey <darr_low <at> yahoo.com> writes:
> 
>> 
>> 
>> I created a text widget to allow my users to enter some lines of text. 
>> Now I
>> need to dump all the text contents into a string variable.  How can i do
>> that?
> 
> Supposing you have no tags, you could do:
> 
> text.get('1.0', 'end') # text is your text widget
> 
> The first parameter is the index1 specifying where to start looking for
> text,
> and the other parameter is the index2, where to stop looking for text (one
> before it). Lines are numbered from 1 and columns from 0, that is why I
> used
> '1.0' (which is accepted as an index), and 'end' is an special index which
> indicates the end of the text.
> 
> 
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-get-all-the-text-from-a-text-widget--tp17053954p17243544.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list