Emoji in dash python

I would like to add emoji(:grinning::grin::grin::neutral_face::expressionless::grinning:) in an table in DASH python but I can’t do it.
Does anyone have any ideas that can help me display the emoji on the board.
Thank you in advance.:pray:

1 Like

Could you show an example of how to do this in practice? I’m trying to put an emoji on a html.Button, but I cannot figure out how. The emoji in question is this: https://emojiguide.org/backhand-index-pointing-down

I’ve tried to use the HTML entity:
html.Button('👇')

…but it will display the raw string on the button. I am able to put other special characters on it using unicode, example:

html.Button('\u1234')

However, trying
html.Button('\u1f447')
…will not work - it will display:

\u1f44+ the number 7.

What am I doing wrong…? Some pointers would be much appreciated…

(I’m using Python3)

This is possibly the same question: How to Convert Button name with Tag or entity as button text using Dash/Plotly?

Python string literals support 2, 4, or 8 digit escape characters: Unicode HOWTO — Python 3.12.1 documentation

For 2 digit escape characters (ASCII) you use \x, for 4 digit escape characters (Unicode code points less than or equal to FFFF) you use \u, and for 8 digit escape characters you use \U. So as your Unicode code point is greater than FFFF you do the following:

html.Button('\U0001F447')
2 Likes

Something that’s worked for me is literally just copying and pasting the emoji into my IDE in the relevant location.

2 Likes

Thanks, both of you. I had actually tried \U0001F447, and copying it directly into the IDE, none of which worked. But, I now realize that they probably do work - it’s the browser that’s acting up. Seems to be an issue with Chromium on unix. I now see it does the same on other websites as well. Firefox (unix) seems to display it as it should.

I guess the moral of the story is: Don’t assume that testing in only one browser gives the full picture… :slight_smile:

3 Likes