If we want to remove the entry widget contents we can use delete
with entry object.
Example
$ent->delete(0,'end');
But I want to remove the Text widget contents.Can any one tell me what is the function for removing the text widget contents?
use the following way
use Tk;
use Tk::Text ;
....
.....
my $txt = $mw->Text( -background
=>'white', )-> pack ();
$txt -> delete('1.0','end');
Refer the Links.
http://legacyweb.triumf.ca/people/cpayne/perl/Tk/Text.html>Tk::Text
Related
I've been looking for a solution to this but I cannot seem to find one for linking an edge label to another GraphViz Dot Graph. For example, if I have a graph called 'mydotimage2.svg' produced from the following:
digraph G
{
graph [compound = true];
subgraph cluster_0
{
node [style = bold];
"A" "B" "C";
}
subgraph cluster_1
{
node [style = bold];
"One" "Two" "Three";
}
"A" -> "One" [lhead = cluster_1, ltail = cluster_0, label = "Falafel", href = "~/workspace/GraphViz/mydotimage1.svg"]
}
If I create the 'mydotimage2.svg' SVG image in my terminal via:
dot -T svg mydotimage2.dot > mydotimage2.svg
The image opens just fine in my browser, and the edge label from A to One in the produced image is clickable, but does not open mydotimage1.svg which is in the same GraphViz directory as well. Does anyone know how to do this? I would really appreciate it. Thanks in advance.
You should use relative paths.
That is, instead of href = "~/workspace/GraphViz/mydotimage1.svg" use href = "./mydotimage1.svg"
BTW, instead of using pipe redirection(>) you can specify desired output file name as a parameter to the dot.
Just append -omydotimage2.svg to the command line.
Where "mydotimage2.svg" is the file name you want to write to.
This is what I observe on my machine, I guess it's a general problem:
graphviz does expand the tilde ~ to but it does not remove the tilde. In my case I see /home/rainer/~/workspace/GraphViz/mydotimage1.svg as image location when I click on the hyperlink in the graph. That obviously doesn't exist. Looks like a bug to me...
The solution / workaround is to replace the ~ in the script with your home folder path, in my case
href = "/home/rainer/workspace/GraphViz/mydotimage1.svg"
which works as expected.
I have a QTextEdit window with words and letters displayed in several colors. I want to be able to retrieve the color of each part of the text when processing the contents of the window. My attempt so far has been to save the entire contents as an html file and then parse through that to extract only the text with the color information. This is very cumbersome and difficult. I would much prefer to process the text using the QTextCursor if I could retrieve the color of the text at the cursor position. I have searched for the appropriate function but have not found one.
Is there a function to retrieve the color (or the format) at the QTextCursor position?
Or alternatively is there a way to retrieve each contiguous section of words and/or characters that have the same color (or format) with the format information?
Well I have found a way to do what I wanted. Here is the relevant code:
QTextCursor tc = qte->textCursor();
tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
while(tc.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor))
{
QTextCharFormat tcf = tc.charFormat();
int bg = tcf.background().color().rgb();
int fg = tcf.foreground().color().rgb();
printf("bg=%x fg=%x\n", bg, fg);
}
any comments or improvements are welcome.
[Corrected above]: I originally had
QColor bg = tcf.background().color().rgb();
QColor fg = tcf.foreground().color().rgb();
but with .rgb() on the end, it converts QColor to int.
I'm trying to look through the jquery-ui.js file at the autocomplete function. I have autocomplete working just as I would like, however I would like to add a feature. I would like the color of the results to change for that single line item based on the value.
For example if the text value contains the substring test, the color of the text should be red instead of what is defined using the css color.
Found the answer. I had to edit this part of the code in the auto complete section of the file. I added a check that looked at the item.label value, if the value called for a color change I added the red style to the anchor tag (style="color:red;").
_renderItem: function( ul, item ) {
return $( "<li>" )
.append( $( "<a>" ).text( item.label ) )
.appendTo( ul );
},
I have ~3,600 html files with a ton of image tags in them. I'd like to be able to capture all the src attribute values used in these files and aggregate them into a text file where I can then remove duplicates and see how many unique image filenames there are overall.
I use BBEdit and I can easily use regex and multi-file search to find all the image references (18,673), but I don't want to replace them with anything -- instead, I want to capture them from the BBEdit search results 'Notes' and push them into another file.
Is this something that can be AppleScripted? Or are there other means to the same end that would be appropriate?
You've got a tall task there because there's many parts of this you have to solve. To give you a start, here's some advice on reading one html file and putting all the src images in an applescript list. You have to do much more than that but this is a beginning.
First you can read a html file into applescript as regular text. Something like this will get the text of one html file...
set theFile to choose file
set htmlText to read theFile
Once you have the text into applescript you could use text item delimiters to grab the src images. Here's an example. It should work no matter how complex the html code...
set htmlText to "<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />
<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />
<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />"
set text item delimiters to "src=\""
set a to text items of htmlText
if (count of a) is less than 2 then return
set imageList to {}
set text item delimiters to "\""
repeat with i from 2 to count of a
set thisImage to first text item of (item i of a)
set end of imageList to thisImage
end repeat
set text item delimiters to ""
return imageList
I hope that helps!
How to add Text to CCSprite Object. I Have 7 Sprite objects now i want to add text to that Sprite Objects with different Text. and how to change that text.
Help me...
E.g. for one sprite:
//Make a CCLabelTFF
CCLabelTTF *label1 = [CCLabelTTF labelWithString:#"text1" fontName:#"Arial" fontSize:25];
//add it to the sprite
[sprite1 addChild: label1];
If you need to create many labels than I would prefer to use a CCLabelBMFont (better performence)
CCLabelBMFont* labelBMF1 = [CCLabelBMFont labelWithString:#"text1" fntFile:#"fntfile.fnt"];
[sprite1 addChild: labelBMF1];