[Tutor] small graphics question

boB Stepp robertvstepp at gmail.com
Tue Feb 9 18:20:31 EST 2021


On 21/02/09 10:36PM, nathan tech wrote:

>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!)

I just realized I may not be answering the correct questions!  Are you
really asking how to display superscripts, fractions, etc., say in a print
function?  If you know the Unicode code point for the symbol you wish to
generate you can use the chr() function.  But this sounds like you are
going to quickly get into font size issues and placements in the case of
fractions.  Surely wxPython has ways of dealing with these?

Sorry about the earlier response.  Didn't mean to underestimate you!

-- 
Wishing you only the best,

boB Stepp


More information about the Tutor mailing list