tkinter function outout to text widget
Alf P. Steinbach
alfps at start.no
Sat May 29 18:11:09 EDT 2010
* Johan Lans, on 29.05.2010 22:51:
> Hi
> I'm totally new on python and I'm doing an assignement where I'm doing
> a class that manipulates a text. The program is also supposed to have
> a GUI, for which I have used tkinter.
> So far I have entry widgets for file names and buttons, its all
> working like I want it to.
> What is missing is a way to output the changes to the text. I was
> thinking that a text-widget would be suitable. Is there a reasonably
> easy way to do this?
> I tried inserting a string to the textwidget and letting the class
> method change this string, but the inserted string isn't updated in
> the text-widget.
If that is a direct Python string, then you're not changing the string. Python
strings are immutable. So, then you're at most changing which string a variable
or attribute is referring to.
However, if it is some Tkinter thing (I seem to recall that Tkinter offers some
automatic update magic via something-something), then I don't know.
> Would be very happy for any hints.
Just update the widget whenever you change the text.
Cheers & hth.,
- Alf
--
blog at <url: http://alfps.wordpress.com>
More information about the Python-list
mailing list