Re: canvas: change the background of a text item

Liste des GroupesRevenir à cl tcl 
Sujet : Re: canvas: change the background of a text item
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tcl
Date : 30. Oct 2024, 14:42:02
Autres entêtes
Message-ID : <ygar07xwvv9.fsf@akutech.de>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* Ralf Fassel <ralfixx@gmx.de>
| Is there a way to change the background of a text item on a canvas?
| I can change the color of the text via -fill, but I found no way to
| change the background color of the text:
>
|   pack [canvas .c] -fill both -expand yes
|   # red text on yellow background
|   .c create text 100 100 -text "Example text" -font {Helvetica 20} -fill red
|  
| => how to change the background of the text field to yellow?
|    i.e. the same as ".c configure -background yellow", but restricted
|    to the area of the text.

Ok, found a workaround on the WIKI:

  https://wiki.tcl-lang.org/page/canvas+text
 
  - create a rectangle with the bbox of the text and lower it beneath
    the text.

Somehow the 'rectangle' item was not there when I scanned the canvas
manpage earlier :-/

R'

Date Sujet#  Auteur
30 Oct 24 * canvas: change the background of a text item4Ralf Fassel
30 Oct 24 `* Re: canvas: change the background of a text item3Ralf Fassel
30 Oct 24  `* Re: canvas: change the background of a text item2undroidwish
30 Oct 24   `- Re: canvas: change the background of a text item1saito

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal