[Tutor] small graphics question

Rudy Matela rudy at matela.com.br
Wed Feb 10 09:10:59 EST 2021


Hi Nathan,

Maybe this is not exactly what you are looking for, but maybe you can
use Unicode
characters
<https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts> for
that:

* superscripts
<https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts>: x⁰,
x¹, x², x³, x⁴, x⁵, x⁶, x⁷, x⁸, x⁹, for example: 2³²
* vulgar fractions
<https://unicode-search.net/unicode-namesearch.pl?term=FRACTION>: ½, ¼, ¾,
⅕, ⅙, etc...

Since Python supports Unicode (and possibly wx python), you can use these
in regular Python strings:

$ python
>>> print("2³² + ½")
2³² + ½

Best Regards,
Rudy

On Tue, Feb 9, 2021 at 7:37 PM nathan tech <nathan-tech at hotmail.com> wrote:

> Hi Folks,
>
>
> I was originally going to ask this over on the wx python mailing list,
> but I found myself hesitating.
>
> I am pondering a simple question:
>
> How do I write x to the power of y, in python/
>
> Not 5^2 for 5 squared, but 5 superscript 2? or 5 superscript x where x
> is any number?
>
> Similarly, how do I produce fractions??
>
> I asked here in the end because I figure for wx python it is just
> tracking down that character sequence and then writing it on screen
> (which I can do!)
>
> Thanks in advance,
>
> Nathan
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list