By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,400 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,400 IT Pros & Developers. It's quick & easy.

tkinter, overwrite Label-text?

P: n/a
using python And tkinter.

i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.

what is the best way to achieve that?

also, how do i make Label-text expand to the right and not to the left?
Apr 10 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Apr 10, 2:35 pm, skanem...@yahoo.se wrote:
using python And tkinter.

i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.

what is the best way to achieve that?
[...]
Which widget do you use?

Some widgets can be connected to variables so that when the variable
changes the widget is automatically update.
Have a look <at http://docs.python.org/lib/node696.html>.

HTH,
Dennis Benzinger
Apr 10 '08 #2

P: n/a
On 10 Apr, 15:28, "Dennis.Benzin...@gmx.net"
<dennis.benzin...@gmx.netwrote:
On Apr 10, 2:35 pm, skanem...@yahoo.se wrote:
using python And tkinter.
i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.
what is the best way to achieve that?
[...]

Which widget do you use?

Some widgets can be connected to variables so that when the variable
changes the widget is automatically update.
Have a look <athttp://docs.python.org/lib/node696.html>.

HTH,
Dennis Benzinger
i use the Label-widget.
Apr 10 '08 #3

P: n/a
On Apr 10, 4:37 pm, skanem...@yahoo.se wrote:
[...]
i know how to do this already. the problem is i want the text to stay
in the windowa nd not start overwriting "Answer:".
i have solved this by using an Entry for the answer as well but id
prefer using a Label.
[...]
You can set the width option of the Label. For example:

b = Label(mygui, text=eval(expr), width=20)

Then the Label will always be 20 characters wide no matter how long
the answer is.
You can read more about the options for Tk widgets in <http://
www.tcl.tk/man/tcl8.5/TkCmd/contents.htm>.

Dennis Benzinger
Apr 10 '08 #4

P: n/a
On Thu, 10 Apr 2008 07:37:08 -0700, skanemupp wrote:
i know how to do this already. the problem is i want the text to stay
in the windowa nd not start overwriting "Answer:".
Then don't use `place()` but let Tkinter handle the layout with the pack
and/or grid layout manager. GUIs with `place()` are a bad idea because
the GUI may look odd or is even unusable on other peoples computers with
other screen resolutions, fonts, and font sizes.

Ciao,
Marc 'BlackJack' Rintsch
Apr 10 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.