473,418 Members | 2,009 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,418 software developers and data experts.

Writing in Python Tkinter Textwidget with specified line number.

Hi all !

I am developing GUI in Python Tkinter for one application.
In this I have created one Text box. And I need to insert the text inside the text box directly in to some paticular line say 10th line, without inserting any '/n' before that line...
For Example :
text = Text(parent, height, width, .... ) # Creating Text widget inside its parent.
text.insert(INSERT, "Hi\n") # inserting "Hi" in the first line
text.insert("%d.%d"%(10, 0), "Hello") # Now Inserting "Hello" at 10th row or line.

But whenever I execute this program, The text is always inserted at the next line(2nd line)line only... and not at the 10th line.....
Is there any way to solve this problem? Please help me out...

Thanks in advance,
Shambhu.
Aug 8 '07 #1
2 2899
nisyna
8
I have the same problem...but I havent't still found a solution.
Now I use PIL and wxwidgets and the situation is better.
Aug 8 '07 #2
bartonc
6,596 Expert 4TB
Hi all !

I am developing GUI in Python Tkinter for one application.
In this I have created one Text box. And I need to insert the text inside the text box directly in to some paticular line say 10th line, without inserting any '/n' before that line...
For Example :
text = Text(parent, height, width, .... ) # Creating Text widget inside its parent.
text.insert(INSERT, "Hi\n") # inserting "Hi" in the first line
text.insert("%d.%d"%(10, 0), "Hello") # Now Inserting "Hello" at 10th row or line.

But whenever I execute this program, The text is always inserted at the next line(2nd line)line only... and not at the 10th line.....
Is there any way to solve this problem? Please help me out...

Thanks in advance,
Shambhu.
Hi Shambhu. The problem is not only is Tkinter very limited, but text widgets of this type are completely line based (a newline counts as one line).

Our new friend, nisyna, has the right suggestions. In order to get the effect that you are after, you'll need to be working with a graphical (bit mapped) widget.

Hope that helps.
Aug 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Brian Kazian | last post by:
I am currently having trouble running a piece of code I have written. My main code is called new.py, and when I run it, it pops up the TKinter root window as specified. However, if I try perform...
2
by: nholtz | last post by:
Is there any way to delete a widget (window) from a Text widget, and then add it back to the Text, without re-creating the original widget. For example, I think I would like to do something like...
27
by: bcwhite | last post by:
I've been trying to find out what the future of Python is with regard to Tk. It seems there are several interfaces that make use of new functionality, including "Tile" and "Ttk". If I want to...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.