Does tkx have a tagConfigure equivalent and a way to change text colors on a text widget? - tkx

Does tkx have a tagConfigure equivalent and a way to change text colors on a text widget?
I have a tool I created years ago based on perl tk which I am trying to convert to tkx using ActivePerl 5.x and beyond. I have made progress but one of the items I am stumped on is changing font colors in a text widget. With tk I used tagConfigure.
$txt->tagConfigure('normal', -font=>"Arial 10", -foreground=>"white");
$txt->tagConfigure('bold', -font=>"Arial 10 bold", -foreground=>"white");
$txt->tagConfigure('FC1', -font=>"Arial 10", -foreground=>"orange");
….
Then I used the insert function to append the text with the color I wanted.
$txt->insert(‘end’,$TEXT,$COLOR);
It appears as if tkx uses “$txt->insert_end($TEXT);”, but it doesn’t appear to allow you to change colors.

I finally found the answer. This is the correct syntax for tkx:
$txt->tag_configure('FC7', -font=>"Arial 10", -foreground=>"black", -background=>"white");
$txt->insert_end("My message\n", "FC7");

Related

Put borders to a text mesh

I want to make a simple text box prefab. How can I keep the text in the textbox? Very simple question :)
Couldn't be easier
(1) Add a canvas
HINT always select "Scale with screen size" (Unity accidentally setthe wrong default there; you only ever use "Scale with screen size")
(3) Add UI -> Text
Set horizontal to WRAP
Look at the large yellow arrow
Leave the vertical as overflow (just choose a small height, say 10, for the box: it is irrelevant).
Set the width of the box to whatever you want - other large yellow arrow.
(In your specific example, it looks like you have a gray box, with a Text sitting on top of that gray box. You should simply make the text box expand to fit the gray box.)
Unity's reactive layout system is fantastic. If you're just getting started with it, search on here for QA and don't hesitate to post more questions. It is hard to master, but worth it.

display.newText isnt working

first time user of Stackoverflow;
Problem: even at the basic level of trying to print out simply Hello world nothing seems to happen.
using this:
local text = display.newText("helloworld", 50, 50, native.systemFont, 24)
print(text)
the varible "text" when printed holds the value of "Table: 010F3E50" which changes on each reload
im new to this language and this is really annoying - Any help would be fantastic
Cheers
Actually, you are trying to print the object. Not the text inside. So try:
print(text.text)
Instead of:
print(text)
Keep coding............ :)
The color of the text might be black by default which might be the same color as the background in the simulator. Meaning it's visible but you just can't see it!
Trying changing the color of the text object by doing this:
text:setFillColor(1,0,0) -- red text

Fabric.js - text decoration looks not exactly right

This image is from kitchensink, and the problems are :
Line through doesn't exactly at right place (see the left text at top)
When it's italic with background color, the text is a bit out of its background (see the left text at top)
Underline is a bit far from text, or can we adjust its distance?
Thanks.
You're seeing an experimental feature — fabric.IText — that's currently in development. It allows to edit text inline and supports partial formatting.
The problem with line-through is known.
Underline being far probably has to do with stretched text. When I load kitchensink it looks good.
Background and italics is an interesting one. I just checked google docs and there's the same problem there:

wxpython textctrl change caret colour

I'm using a wxpython textctrl & would like to hide the caret. After a lot of searching it would appear that the best approach would be to simply change it's colour to white. However I can not work out how to do this.
I found the following info:
SetCaretForeground(fore)
Sets the foreground color of the caret. The parameter fore is a wxColour object, a #RRGGBB string, or a color spec like "white". Returns None.
from here: http://www.yellowbrain.com/stc/caret.html#setfg
The code for my current textctrl is below. Any help would be appreciated.
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
Clinton.
You are using a wx.TextCtrl and the link you give is for a wx.StyledTextCtrl. These are completely different animals, and the wx.StyledTextCtrl has a lot more functionality than the simple wx.TextCtrl.
I don't think there's a way to set the caret color in an ordinary wx.TextCtrl.

Is there a wx Widget to show ANSI escape code colored text?

I can't seem to find a control that will display text colored with ANSI escape codes. For example:
"\e[0;32mHello \e[0;37mWorld"
Would display a green "Hello" and a white "World".
Does one exist?
I don't think that such a widget exists. You may look for some way of changing ANSI codes into HTML and then displaying it in wxWidgets. This may be useful:
http://code.activestate.com/recipes/577349-convert-a-transcript-with-ansi-escape-sequences-to/

Resources