tkinter text widget question

Discussion in 'Python' started by William Gill, Aug 21, 2005.

  1. William Gill

    William Gill Guest

    The tkinter text widget uses indexes to identify row:column offsets
    within the text, but it seems counter intuitive to have to convert row
    and column integers to a string like "0.1'. It's great that index can
    take a string, but what about looping through rows and columns? Am I
    missing a way to use integers directly, or should I create a class that
    takes the two integers and returns them formatted as the proper string?

    Thanks

    Bill
    William Gill, Aug 21, 2005
    #1
    1. Advertising

  2. William Gill

    rafi Guest

    William Gill wrote:
    > The tkinter text widget uses indexes to identify row:column offsets
    > within the text, but it seems counter intuitive to have to convert row
    > and column integers to a string like "0.1'. It's great that index can
    > take a string, but what about looping through rows and columns? Am I
    > missing a way to use integers directly, or should I create a class that
    > takes the two integers and returns them formatted as the proper string?


    tkinter relies on tk that is for tcl at first, and in tcl every thing is
    a string (more or less).

    "%s.%s" % (row, column)

    should answer your problem easily

    my 2 cents

    --
    rafi

    "Imagination is more important than knowledge."
    (Albert Einstein)
    rafi, Aug 21, 2005
    #2
    1. Advertising

  3. William Gill

    William Gill Guest

    rafi wrote:
    > William Gill wrote:
    >
    >> The tkinter text widget uses indexes to identify row:column offsets
    >> within the text, but it seems counter intuitive to have to convert row
    >> and column integers to a string like "0.1'. It's great that index can
    >> take a string, but what about looping through rows and columns? Am I
    >> missing a way to use integers directly, or should I create a class
    >> that takes the two integers and returns them formatted as the proper
    >> string?

    >
    >
    > tkinter relies on tk that is for tcl at first, and in tcl every thing is
    > a string (more or less).
    >
    > "%s.%s" % (row, column)


    Simple enough. (sometimes I can't see the simplest things, without
    complicating them)

    Thanks,

    Bill
    >
    > should answer your problem easily
    >
    > my 2 cents
    >
    William Gill, Aug 21, 2005
    #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. Alex9968
    Replies:
    0
    Views:
    577
    Alex9968
    Mar 19, 2008
  2. dmitrey
    Replies:
    0
    Views:
    1,081
    dmitrey
    Oct 14, 2008
  3. Frederic Rentsch
    Replies:
    0
    Views:
    238
    Frederic Rentsch
    Jul 8, 2012
  4. Terry Reedy
    Replies:
    15
    Views:
    633
    Frederic Rentsch
    Jul 16, 2012
  5. Frederic Rentsch
    Replies:
    0
    Views:
    426
    Frederic Rentsch
    Jul 9, 2012
Loading...

Share This Page