| | |
Text box
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2009
Posts: 15
Reputation:
Solved Threads: 0
Hello!
I have a little problem. I have to print a table (four columns from an Excel file) in a text box. I took a string and I kept appending all the cells from the file that interested me and I used the textbox provided by easygui.
Here are my problems:
1.I want to format the text to look like one piece. The text looks like this:
and I want it to be more nicely arranged (every line to be in it`s place). How can I do that?
2. Is there any way to convert it to read only? Normally the user is able to modify the text but I want it to be read only.
I`m interested if this things are possible using the textbox provided by easygui or I have to modify it and use something else (tkinter etc.).
Thanks!
I have a little problem. I have to print a table (four columns from an Excel file) in a text box. I took a string and I kept appending all the cells from the file that interested me and I used the textbox provided by easygui.
Python Syntax (Toggle Plain Text)
textbox(msg='', title=' ', text='', codebox=0)
1.I want to format the text to look like one piece. The text looks like this:
Python Syntax (Toggle Plain Text)
TimeStamp Ipv Upv-Ist Power 6.15 0.0 293.92 0.0 6.30 0.0 315.21 0.0 6.45 0.11757 272.14 31.9954998 7.00 0.19193 283.44 54.4006392 7.15 0.25029 292.55 73.2223395 7.30 0.30235 301.25 91.0829375 7.45 0.35982 320.71 115.3978722 8.00 0.75405 313.93 236.7189165 8.15 1.12258 316.05 354.791409 8.30 1.5482 314.7 487.21854
2. Is there any way to convert it to read only? Normally the user is able to modify the text but I want it to be read only.
I`m interested if this things are possible using the textbox provided by easygui or I have to modify it and use something else (tkinter etc.).
Thanks!
Last edited by catcit; Aug 11th, 2009 at 9:58 am.
Set up a formatted string before you send it to the Textbox. Here is an example:
python Syntax (Toggle Plain Text)
# example to set up a table formatted string import math # set up the format strings (use - for left justified) header = "%-12s %-12s %-12s \n" line_fs = "%-12f %-12.4f %-12.4f \n" table = '' table += (header % ('radians', 'sine', 'cosine')) for x in range(0, 11): rad = math.radians(x) table += (line_fs % (rad, math.sin(rad), math.cos(rad))) print(table) """my output (use a fixed font like Courier) --> radians sine cosine 0.000000 0.0000 1.0000 0.017453 0.0175 0.9998 0.034907 0.0349 0.9994 0.052360 0.0523 0.9986 0.069813 0.0698 0.9976 0.087266 0.0872 0.9962 0.104720 0.1045 0.9945 0.122173 0.1219 0.9925 0.139626 0.1392 0.9903 0.157080 0.1564 0.9877 0.174533 0.1736 0.9848 """
No one died when Clinton lied.
•
•
Join Date: Dec 2006
Posts: 1,026
Reputation:
Solved Threads: 288
•
•
•
•
2. Is there any way to convert it to read only? Normally the user is able to modify the text but I want it to be read only.
"Display some text in a monospaced font, with no line wrapping.
This function is suitable for displaying code and text that is
formatted using spaces.
The text parameter should be a string, or a list or tuple of lines to be
displayed in the textbox."
http://easygui.sourceforge.net/curre....html#-codebox
So you can send a list of lines to be printed. Sweet.
Last edited by woooee; Aug 12th, 2009 at 5:29 pm.
Linux counter #99383
![]() |
Similar Threads
- writing from bottom up in rich text box (VB.NET)
- pass the value to the text box (JavaScript / DHTML / AJAX)
- a default value in a text box (Visual Basic 4 / 5 / 6)
- Text Box Newbie help (Visual Basic 4 / 5 / 6)
- Text box question (C#)
- Text box population from DBgrid. HELP!! (Visual Basic 4 / 5 / 6)
- text is being written in text box (Web Browsers)
- Help with text box height (HTML and CSS)
- Cannot enter any text in a IE text-box (Viruses, Spyware and other Nasties)
Other Threads in the Python Forum
- Previous Thread: How to split a string every 3 spaces?
- Next Thread: Pressing a key to type a string
| Thread Tools | Search this Thread |
accessdenied advanced aliased argv beginner bits calling casino change command convert count csv cturtle cursor def dictionary digital dynamic dynamically enter event examples external file float format frange function google gui hints homework i/o iframe import info input jaunty java keyboard lapse line linux list lists loop microphone mouse multiple newb number numbers obexftp output parameters parsing path port prime programming projects py py2exe pygame pygtk pyopengl python random recursion return scrolledtext signal skinning sprite stderr string strings subprocess table tennis terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode urllib urllib2 variable voip web-scrape whileloop windows wxpython






