473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Text widget - insert line

hello,
I have got a data list.
In my Text widget each data is between the previous and the next; so they
are whole in a only block.
Now:
|--------------------
|BushBerlusconiBlair|
|AlpacinoDeNiroStall|
|oneetcetcetcetcetce|
| |
| |
| |
| |
|-------------------|

How I have to create for each data a singular line.
right version:
|--------------------
|Bush |
|Berlusconi |
|Blair |
|Al Pacino |
|DeNiro |
|Stallone |
| |
| |
|-------------------|
Thank you very much!!!
--

questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad ab***@newsland.it
Jul 18 '05 #1
7 2011
Beps wrote:
hello,
I have got a data list.
In my Text widget each data is between the previous and the next; so they
are whole in a only block.
Now:
|--------------------
|BushBerlusconiBlair|
|AlpacinoDeNiroStall|
|oneetcetcetcetcetce|
| |
| |
| |
| |
|-------------------|

How I have to create for each data a singular line.
right version:
|--------------------
|Bush |
|Berlusconi |
|Blair |
|Al Pacino |
|DeNiro |
|Stallone |
| |
| |
|-------------------|
Thank you very much!!!


I'm not sure I understand the question... Do you have some code generating the
first, and you want it to generate the second? If my guess is correct, can you
show us the code? It will surely only be a matter of inserting a '\n' at the end
of each line, then do a textWidget.insert(END, ...), but I'm just guessing here...
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
Jul 18 '05 #2
Eric Brunel ha scritto:
I'm not sure I understand the question... Do you have some code generating the first, and you want it to generate the second? If my guess is correct, can you show us the code? It will surely only be a matter of inserting a 'n' at the end of each line, then do a textWidget.insert(END, ...), but I'm just guessing

here...

Here there's my code:
def show_customers(self, customers) :
## data is a list
for data in customers:
dato = operator.concat(str(data), '/n')
self.text_wdg.insert(0.0, data)####
## self.text_wdg.insert(, '/n')

But is wrong, output:
|-----------------------------|
|datadatadata/ndatadatadata/n |
|datadatadata/ndatadatadata/n |
| |
|-----------------------------|

How I can do?
Thank you

--

questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad ab***@newsland.it
Jul 18 '05 #3
beps wrote:
Eric Brunel ha scritto:
I'm not sure I understand the question... Do you have some code generating

the
first, and you want it to generate the second? If my guess is correct, can

you
show us the code? It will surely only be a matter of inserting a 'n' at the

end
of each line, then do a textWidget.insert(END, ...), but I'm just guessing

here...

Here there's my code:
def show_customers(self, customers) :
## data is a list
for data in customers:
dato = operator.concat(str(data), '/n')

^^
You have to use \n, not /n.

Reinhold

--
[Windows ist wie] die Bahn: Man muss sich um nichts kuemmern, zahlt fuer
jede Kleinigkeit einen Aufpreis, der Service ist mies, Fremde koennen
jederzeit einsteigen, es ist unflexibel und zu allen anderen Verkehrs-
mitteln inkompatibel. -- Florian Diesch in dcoulm
Jul 18 '05 #4

def show_customers(self, customers) :
## data is a list
for data in customers:
dato = operator.concat(str(data), '/n') ^^
You have to use n, not /n.

Reinhold


Yes, excuse me, this is my code now:
def show_customers(self, customers) :
#customers is a list
for data in customers :
self.text_wdgt.insert(0.0, data)
self.text_wdgt.insert(0.0, '\n')


but the following is the output :
---------------
|data[last]
|data[....]
|data[....]
|data[....]
|data[first]
|--------------

I must obtain the exact contrary :
---------------
|data[first]
|data[....]
|data[....]
|data[....]
|data[last]
|--------------

There's an error in the indices of insert() method of Text widget.
The first data line one goes on the second and so on.
I would have to obtain the exact index of the line end.
But I have not still understood and tried like making.

If you have a ready example you show it to me, please.
thanks for all


--

questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad ab***@newsland.it
Jul 18 '05 #5
beps wrote:
def show_customers(self, customers) :
## data is a list
for data in customers:
dato = operator.concat(str(data), '/n')


^^
You have to use n, not /n.


Reinhold

Yes, excuse me, this is my code now:
def show_customers(self, customers) :
#customers is a list
for data in customers :
self.text_wdgt.insert(0.0, data)
self.text_wdgt.insert(0.0, '\n')

but the following is the output :
---------------
|data[last]
|data[....]
|data[....]
|data[....]
|data[first]
|--------------

I must obtain the exact contrary :
---------------
|data[first]
|data[....]
|data[....]
|data[....]
|data[last]
|--------------

There's an error in the indices of insert() method of Text widget.
The first data line one goes on the second and so on.
I would have to obtain the exact index of the line end.
But I have not still understood and tried like making.

If you have a ready example you show it to me, please.
thanks for all


This is happening because you are telling the widget to insert the new
items at the start (0.0). If you replace this with END instead it should
work as you want.

regards
Steve

--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #6

as you have written you I return to the problem begins them, that is the
customers do not go to new line. I must recover the index of the last
column of the data.
--

questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad ab***@newsland.it
Jul 18 '05 #7
beps wrote:
as you have written you I return to the problem begins them, that is the
customers do not go to new line. I must recover the index of the last


You may also try the Italian newsgroup it.comp.lang.python in case you are
not feeling entirely comfortable with the English language.

Peter

Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: T. Kaufmann | last post by:
Hi there, I have some lines of code in a Tkinter programm - I want to list every single file of a zip-archive in a Text widget: fp = os.popen("%s %s" % ('unzip -vl ', 'anyarchiv.zip', 'r')...
7
by: Jane Austine | last post by:
As you add more items, say text lines, in Text widget, it gets too slow and almost impractical to use on. Take idle for example. If the text gets bigger(e.g. print...
1
by: snx7s | last post by:
Hi, using Tkinter, on a Text widget i would like to place the cursor to a given position like the icursor() method of the Entry widget. Is it possible do that, if it is how please ? Thank You.
2
by: Tonino | last post by:
Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the...
2
by: wanwan | last post by:
I need my GUI to open and display a text file. I'm thinking of using a text widget but it looks so complicated in the tkinter manual. question I have is: is there an example anyone can find on...
6
by: rahulnag22 | last post by:
Hi, Is it possible to have different items in a listbox in different colors? Or is it just one color for all items in a listbox? Thanks Rahul
3
by: mariox19 | last post by:
Are Tkinter widgets running on their own thread? If I try to make a simple application that will print the letters A to Z to a Tkinter Text widget, and I space the printing of each letter by 1...
0
by: John McMoangle | last post by:
Hey guys. I am having trouble understanding the get() method from The arguments to the get method of the Text widget are strings in the form of "line.position". So, text.get('1.5', '2.7')...
4
by: Mudcat | last post by:
I've tried quite a few things to get this correct but have hit a couple of sticking points that I can't figure out. I need to ge the Text box to function like the 'wraplength' option in a Label. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.