Using Perl/Tk, I have a label that I want to use with both text and a picture.
To set the text I use
$text_replacement_res = $wg_name->configure(-text => $new_text);
To set the picture I use
$image_name_full = $image_loc . $new_image;
$image_use = $mw_Main->Photo(-file => $image_name_full);
$wg_name->configure(-image => $image_use);
where
$wg_name is the name of label widget
$new_text is the new text for the label
$mw_Main is the top level widget
$image_loc is the directory in which the image is stored
$new_image is the file name of the image
This allows me to:
Swap text for text
Image for image
Text for image
However it fails when I try and swap an image for text.
What do I have to do to achieve this?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.