473,383 Members | 1,762 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,383 software developers and data experts.

Tkinter.Text can never be empty?

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.
Jul 18 '05 #1
2 2931
"Harry Pehkonen" <ha************@hotpop.com> schrieb im Newsbeitrag
news:70**************************@posting.google.c om...
| 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.
Jul 18 '05 #2
> | >>> 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.
Jul 18 '05 #3

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

Similar topics

8
by: Eric Brunel | last post by:
Hi all, I was creating a Tkinter widget in the style of the reversed tabs below Excel worksheets and I stepped in a serious problem: the code I made makes python crash with a seg fault, bus...
4
by: Peter G Carswell | last post by:
Good Morning. I am new to Tkinter. I have been testing the installation of Tkinter through the python web site. The first two test steps give no errors, 'import _tkinter' and 'import Tkinter'....
8
by: Dustan | last post by:
I'm trying to get a scrollbar bound with a Frame, and I keep on getting a scrollbar, but it doesn't actually scroll. Some help, please?
1
by: yvesd | last post by:
hello i want to intercept tkinter python system events like wm_delete_window and if possible for any window, but the newest code I've produced give me an error : Traceback (most recent call...
5
by: H J van Rooyen | last post by:
Hi, I am struggling to get the pack method to do what I intend. I am trying to display user input in a seperate window, along with a little description of the field, something like this: ...
44
by: bg_ie | last post by:
Hi, I'm in the process of writing some code and noticed a strange problem while doing so. I'm working with PythonWin 210 built for Python 2.5. I noticed the problem for the last py file...
0
by: wolfonenet | last post by:
Hi All, My setup is: WinXP Python 2.5.1 TKinter version: $Revision: 50704 $ Tcl: 8.4 Debugger: WinPdb
8
by: Lie | last post by:
Inspect the following code: --- start of code --- import Tkinter as Tk from Tkconstants import * root = Tk.Tk() e1 = Tk.Entry(root, text = 'Hello World') e2 = Tk.Entry(root, text = 'Hello...
3
by: J-Burns | last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in programming itself... :P. Need some help here. Problem 1: How do I make something appear on 2 separate windows using Tkinter? By...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.