Tkinter.Text can never be empty?

Discussion in 'Python' started by Harry Pehkonen, Sep 16, 2003.

  1. While setting up some unit tests, I came to the conclusion that a
    Tkinter Text widget can never be empty, but will always (?) contain a
    \n. Here is a brief example:

    >>> import Tkinter
    >>> t = Tkinter.Text()
    >>> t.get(0.0, Tkinter.END)

    '\n'
    >>> t.delete(0.0, Tkinter.END)
    >>> t.get(0.0, Tkinter.END)

    '\n'
    >>>


    My apologies, but I have not checked whether or not this can be
    reproduced in Tcl/Tk (which I think might have been appropriate).

    My question is: Is there *always* a trailing \n, is this a bug, or am
    I doing something silly?

    Thanks!
    Harry.
    Harry Pehkonen, Sep 16, 2003
    #1
    1. Advertising

  2. "Harry Pehkonen" <> schrieb im Newsbeitrag
    news:...
    | While setting up some unit tests, I came to the conclusion that a
    | Tkinter Text widget can never be empty, but will always (?) contain a
    | \n. Here is a brief example:
    |
    | >>> import Tkinter
    | >>> t = Tkinter.Text()
    | >>> t.get(0.0, Tkinter.END)
    | '\n'
    | >>> t.delete(0.0, Tkinter.END)
    | >>> t.get(0.0, Tkinter.END)
    | '\n'
    | >>>
    |
    | My apologies, but I have not checked whether or not this can be
    | reproduced in Tcl/Tk (which I think might have been appropriate).
    |
    | My question is: Is there *always* a trailing \n, is this a bug, or am
    | I doing something silly?

    Nope, this is one of the idiosyncrasies of our friend the Text widget;
    there's always this immortal LF at the end.

    Vincent Wehren
    |
    | Thanks!
    | Harry.
    vincent wehren, Sep 16, 2003
    #2
    1. Advertising

  3. > | >>> t = Tkinter.Text()
    > | >>> t.get(0.0, Tkinter.END)
    > '\n'
    > | My question is: Is there *always* a trailing \n, is this a bug, or am
    > | I doing something silly?
    >
    > Nope, this is one of the idiosyncrasies of our friend the Text widget;
    > there's always this immortal LF at the end.
    >
    > Vincent Wehren


    Thanks, Vincent :D

    Harry.
    Harry Pehkonen, Sep 19, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    empty/non-empty element

    John, Jul 15, 2003, in forum: XML
    Replies:
    1
    Views:
    1,023
    Klaus Johannes Rusch
    Jul 16, 2003
  2. Lukas
    Replies:
    3
    Views:
    803
    spiff
    Nov 10, 2005
  3. Soren Kuula
    Replies:
    1
    Views:
    445
    Henry S. Thompson
    Dec 1, 2005
  4. Kevin
    Replies:
    4
    Views:
    421
    Irrwahn Grausewitz
    Oct 17, 2003
  5. Marcia Hon

    Check if a directory is empty and empty it

    Marcia Hon, Feb 8, 2004, in forum: C Programming
    Replies:
    8
    Views:
    573
    Dave Thompson
    Feb 14, 2004
Loading...

Share This Page