f



Text widget - save the text with tags

I'm trying to write a text editor with Tk::Text.

The Tk::Text widget has a very sophisticated mechanisms using 'tags'
for applying formatting (font, size, bold, etc) to the text in the
widget.

Is there any way to save this formatting
when saving the text from the widget to a file?   The Tk::TextUndo
widget has the Save method - but it strips all tags out and just
saves the plain text.

I presume one needs a markup language of some sort
to represent the tags - and when reading the file back in
you apply the tags again.

So ... a rich text widget in Tk?
Any fancy way to use Tk::Text to accomplish this?

Thank you,
Jon
0
JonB
5/27/2010 5:34:08 AM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

0 Replies
1124 Views

Similar Articles

[PageSpeed] 42

Reply:

Similar Artilces:

text in a widget, text-widget
hello i have an application with a couple of text widgets but i would like to add some functionalities that at first and second sight are not directly supported by the plain text widget itself - ? for example i would like certain lines of text within the textwidget to take different background colors according to certain parameters also i would like to be able to detect certain sentences or words that would become 'links' and by clicking them i would open up different windows any suggestions to solutions and widgets for the above problems ? - i probably could...

RE: text in a widget, text-widget
You can use tags with in the text widget. See the documentation in Tk::Text for more explanation on how they work. How to configure: $scrolled->tagConfigure('BLUE',-background => 'blue'); $scrolled->tagConfigure('RED',-foreground => 'red'); $scrolled->tagConfigure('GREEN',-foreground => 'green'); Here is how I use them: $scrolled->insert('end',$job_header,'RED') if ($job_header); $scrolled->insert('end',$running_proc,'BLUE') if ($running_proc); $scro...

text-text
Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ...

RE: text in a widget, text-widget #2
Johan, Here this will give you an idea how to create a link in a text widget as well as some other tags. HTH Mike use strict; use Tk; use Tk::Dialog; my $mainWindow = MainWindow->new(-title => "Test Tags"); my $sc_width = 100; my $sc_height = 15; my $scrolled = $mainWindow->Scrolled( "Text", -scrollbars => 'se', -background => 'white', -wrap => &...

text + text
What is "text + text" supposed to do right now? It doesn't seem very useful to me. What about making "text + text" as an equivalent for "text || text"? Most strongly-typed programming languages do this. And MS SQL Server too, I think (CMIIW). -- dave ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond: > What is "text + text" supposed to do right now? Nothing. > What a...

Re: text in a widget, text-widget @ 1146167556
Intrah onat Diria .. Tue, 25 Apr 2006 13:55:44 -0700 ,Van Nieuwenhuize, Mike wrote "Noalim y": > > Johan, > > Here this will give you an idea how to create a link in a text widget as > well as some other tags. > > HTH > > Mike > > use strict; > use Tk; > use Tk::Dialog; > > my $mainWindow = MainWindow->new(-title => "Test Tags"); > > my $sc_width = 100; > my $sc_height = 15; > > my $scrolled = $mainWindow->Scrolled( > ...

Re: text in a widget, text-widget @ 1145998849
Intrah onat Diria .. Tue, 25 Apr 2006 13:55:44 -0700 , ****** wrote "Revera y": > of "unsubscribe ptk" to majordomo@lists.stanford.edu > If you wish to unsubscribe from this mailing list, send the message body > This message was posted through the Stanford campus mailing list server. > ++**=3D=3D > -++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--++**=3D=3D--= > > > > > ,=20 > , _________________ > , |---| > , | > , lead > , ::::::opthe > , oo,loent,uaha > , }, > ,...

RE: text in a widget, text-widget @ 1146167556 #3
Johan, Got to thinking about something that may work for you. Please see my modified code. Basically The only thing that I give it a is a list of words, the tag and tag bind is generated on the fly. Maybe using an approach like this will get you closer to what you wanted. Still kinda lame as you have to create a new tag for each word or in this case url but it at least will allow you to do it on the fly. Mike use strict; use Tk; use Tk::Dialog; my $mainWindow = MainWindow->new(-title => "Test Tags"); my $sc_width = 100; my $sc_height = 15; ...

RE: text in a widget, text-widget @ 1146167556 #2
Not sure exactly what you are trying to do but it sounds like you want word that is clicked on. Quick and dirty way would be: $scrolled->selectWord(); my $word = $scrolled->getSelected(); The above will only get a single word, so would be a challenge if you have a link with multiple words. Lame way: create a separate tag for each word and bind that to a sub for that particular word. These seems like a lot of overhead and I would imagine Text widget would have better feature you can leverage on. Efficient way: ? I will leave that up to you ;) or someone else mor...

highlight text in text widget
Hi, I am trying to make widget that displays text. I also want a search keywords available. The way I have envisioned is something similar to emacs search, i.e. it highlights all the occurrences of the keyword that you are interested in. I am trying to find out if that kind of highlighting be done in widget_text or some other widgets. Can anyone help? Thanks neon writes: > I am trying to make widget that displays text. I also want a search > keywords available. The way I have envisioned is something similar to > emacs search, i.e. it highlights all the occurrences of the keyword &g...

Problem with Tk text widget: I cannot get the tags to be shown...
Hi all, I have been trying for a few hours now to understand what may be wrong with an app of mine. I have a text widget (and a peer), that have 3 tags (named back, 0:0, 1:1). My code tries to "sort" tags, so as all of them are visible. What the algorithm does, is the following: $text tag lower back $text tag raise 0:0 back $text tag raise 1:1 0:0 What I get is this: http://www.ellogon.org/~petasis/tcl/Images/bugs/Tag1.png But if I just type on console: $text tag raise 1:1 I get this: http://www.ellogon.org/~petasis/tcl/Images/bugs/Tag2.png Why is this happening? George...

copying text from table or text widgets
Hello everybody, Can anyone help me on how to copy text from table and text widgets for instance using ctrl+c, to paste the data into notepad or any editor. Thank you, Prashanth ...

Tk text search and elided text
All, I'm having trouble understanding the following text widget behavior. I'm using Tcl/Tk 8.4.9. I've got a text widget with some elided text. A search returns the position L.C (properly), but a subsequent search starting at L.C for the same string fails to return L.C. However, a search with the option -elide does return L.C. The elided text is at the beginning of the line, a good 60 characters before the text in question. Here's the example: # -------------------------------- end toplevel .bfw pack [set t [text .bfw.t]] -expand 1 -fill both set elidetext "to elid...

Replace text with image in text widget
I'm trying to replace an emoticon with an actual image in a text widget. I know I'm not doing this correctly: the sample code below inserts two images randomly and seems to garble the text in other ways. The idea is to have two emoticons (one on each line) and replace them with an image, nothing more. Can anyone take a look and suggest how I might get this to work? Thanks. --- SPfHZvvOGvfQEvfGdvjQE/rNMfrOMfrNPfvQHfzQHfjQLfrNRvjQL/vRJfzRJvrOWvbMh/3VHPfM h/3WHPzVMP7XF/zVMfrPdv7YGP7YG/7YHPzWPPzWPfvUVP7ZHf7ZIPvWVf7aJv7aJ/7bJv7bM/7b NP7cLf7dMPvXeP7dNvrVlv7eOPrWlvvaevrYmP7gRP7gRf7gRv7i...

redirect text to file; text widget
I've loaded text from a file into the text widget, and having edited it would like to redirect it back into a file, but haven't found a handle for it. If there was an attribute such as the "-textvariable" option for the entry and label widgets, I could echo it into a file from another widget (button, etc). Thanks ..t get 0 end "John Peters" <john@jpeters.net> wrote in message news:20060701143102.70526542.john@jpeters.net... > > I've loaded text from a file into the text widget, and having edited it > would like to redirect it back into a fil...

Web resources about - Text widget - save the text with tags - comp.lang.perl.tk

DashboardWidgets - Community for Designers, Developers, and Users of Dashboard Widgets
DashboardWidgets is an internet community for coders, designers, and users of Apple's new Dashboard feature in Mac OS X 10.4, Tiger.

Twidget - Twitter.com Dashboard Widget
Developing Twidget takes time and effort. If you enjoy Twidget, feel it is of value to you and would like to help out, please consider making ...

iBook Widgets - Widgets for iBooks Author
Awesome widgets for iBooks Author

RSS Feed Widget
As its name suggests, is a handy widget to help you embed and display your favorite RSS, just specify the URL of RSS feed, click the "Create ...

Make custom mobile apps, web widgets, and rich media ads — Widgetbox
Mobile web apps, web widgets and rich media powered by the Flite Engagement Platform.

Widgetmate.com : Cool widgets to spice up your webpage
News Widget The News Widget delivers fresh, breaking news from around the world for the topics of your choice to your blog, webpage, website, ...

Widget Press - Creators of iPad, iPhone, iPod touch & Web App Developer Toolkits.
Widget Press, creators of ModelBaker, FormEntry and FormEntry Server, the no programming development tools that builds Web, iPad, iPhone, iPod ...

SIMILE Widgets
This is an open-source “spin-off” from the SIMILE project at MIT . Here we offer free, open-source web widgets, mostly for data visualizations. ...

Motif (widget toolkit) - Wikipedia, the free encyclopedia
... / March 19, 2010 ; 2 years ago ( 2010-03-19 ) In computing, Motif refers to both a graphical user interface (GUI) specification and the widget ...

Preview CrunchBase Widget
The CrunchBase widget allows you to embed information about companies, people, financial organizations, and products anywhere on the web. If ...

Resources last updated: 2/2/2016 10:08:28 AM