tkinter text widget question

W

William Gill

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
 
R

rafi

William said:
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
 
W

William Gill

rafi said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top