[Tutor] small graphics question

Peter Otten __peter__ at web.de
Wed Feb 10 06:01:28 EST 2021


On 09/02/2021 23:36, nathan tech wrote:
> Hi Folks,
>
>
> I was originally going to ask this over on the wx python mailing list,
> but I found myself hesitating.

In such cases my preferred tool is a search engine...

> 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?

...which found me an example for the rich text here:

https://stackoverflow.com/questions/53156000/superscript-in-wxpython-richtextctrl

I also verified that unicode superscript codepoints are displayed
correctly by changing the line

st = wx.StaticText(pnl, label="Hello World!")

in helloworld2.py on

https://www.wxpython.org/pages/overview/#hello-world

to

         st = wx.StaticText(
             pnl, label=
             "Hello World!\N{SUPERSCRIPT ONE}"
             "\N{SUPERSCRIPT TWO}\N{SUPERSCRIPT THREE}"
         )

> 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