tkinter, overwrite Label-text?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • skanemupp@yahoo.se

    tkinter, overwrite Label-text?

    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?
  • Dennis.Benzinger@gmx.net

    #2
    Re: tkinter, overwrite Label-text?

    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

    Comment

    • skanemupp@yahoo.se

      #3
      Re: tkinter, overwrite Label-text?

      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.

      Comment

      • Dennis.Benzinger@gmx.net

        #4
        Re: tkinter, overwrite Label-text?

        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

        Comment

        • Marc 'BlackJack' Rintsch

          #5
          Re: tkinter, overwrite Label-text?

          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

          Comment

          Working...