wxpython

Joal Heagney s713221 at student.gu.edu.au
Sun Sep 2 10:09:44 EDT 2001


Jock Mackenzie wrote:
> 
> I have been learning python/wxpython & have written a small program in
> wxpython that asks for input from the user  [using the function
> wxGetNumberFromUser()] then applies a formula and produces a long integer as
> a result.  I want to display the resulting number from the calculation on
> the wxFrame or wxPanel or in a dialogbox. I cannot find a function for doing
> this. Most message boxes only want to return a string not a long integer as
> I want.
> How do you do this??
> thanks in advance
> regards Jock.

You could pass it a string containing the string representation of the
integer

First we create a long integer.
>>> a = 10000000000000000000000000000000000000L
>>> a
10000000000000000000000000000000000000L

Then there's the str function
>>> str(a)
'10000000000000000000000000000000000000'

Then there's string substitution
>>> "%s" % a
'10000000000000000000000000000000000000'

Which finally allows you to construct sentences with dynamically filled
values.
>>> "%s is a %s" % (a, type(a))
"10000000000000000000000000000000000000 is a <type 'long int'>"
-- 
      Joal Heagney is: _____           _____
   /\ _     __   __ _    |     | _  ___  |
  /__\|\  ||   ||__ |\  || |___|/_\|___] |
 /    \ \_||__ ||___| \_|! |   |   \   \ !



More information about the Python-list mailing list