calling wxPython from the shell

Gerhard Häring gerhard at bigfoot.de
Tue Jun 18 21:49:11 EDT 2002


* Angel Asencio <asencio at mitre.org> [2002-06-18 20:59 -0400]:
> I have been requested to write a function that will take a list, open
> a selection window, and then when the window is closed the function
> would return a list with the selected items.

> Looks like wxPython is quite favored, and I decided to use the Boa
> Constructor, finished the tutorial. Everything fine and dandy, until I
> wanted to create the function that you can call from the shell.
> 
> The scenario that I have tried is for the function to call the MainApp
> (that has the MainLoop) with the Frame that will do the selection. I
> understand about the events, but what ever I do with the event,
> 'myModule.myFunction( [ "a","collection","to","select"])' return
> nothing on the combinations I have tried.

Post source, or else nobody can help you with this particular problem.
Preferrable on the wxPython mailing  list, as that's where the
knowledgeable folks hang around (I'm just a beginner).

> Bottom line is that I want a function call that I can call in the
> shell, like as part of a  print, that I do the selection, and when I

If you want to spoil the fun of finding it out yourself, here's a quick
solution, hacked together with wxMultipleChoiceDialog and wxPySimpleApp.
Replace exec with print to see the source code. Or just execute it to
try it out ;-)

import zlib,base64
exec(zlib.decompress(base64.decodestring("""
eNptkE9LxDAQxe/5FEO9JLIWvS5UWFwQcVcXil5DbKftYP7RZmn99iapHlycQyDvZX4vM93oDMzL
6SsMzpbzAmS8GwNcs+6Po+mjbElp10+/T+bleNaBvMaHwVGD+2wz1mIHRpHlYssglvIeqkyqY6fG
nfdcsGxdwQ40TQFcB02GTFnXUaoixPMpjBsYle2R390Kkd18tLrP1P/+wF/eDocNFCdqPmFyBouL
S+SvKOqAR1JZD24+ulZpLqBK2Ke9fH3+GSCVH8kGKGrU2ARydhspqfERw7vSZ+QiRsDNPVzodYiN
fZo3RklplUEpU0QhZVqSlMUasm6MsW8XN3sP
""")))

Btw. I've learnt everything I know from studying the various parts of
the demo application, there are some very nice goodies hidden there.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 22.2 °C      Wind: 0.9 m/s





More information about the Python-list mailing list