Guification of console app

Peter Hansen peter at engcorp.com
Thu Nov 24 21:34:55 EST 2005


metiu wrote:
> Say I have a console app that does something in three steps:
> - opens a file
> - transfers the file through a serial port
> - does some elaborations
> 
> and I want to build a GUI around it that, for example, sets the file
> name to open or starts the different steps.
> 
> I started using wxPython (actually boa-constructor) to build a frame
> with everything I want.
> The problem is: when the console app method is working, the GUI is
> locked...
> 
> How can the console app communicate with the GUI in order to make it
> tick (think of status messages, progress bars, log messages...)?
> If I use threads and events, or wxYield, or EVT_IDLE, I'm tweaking the
> console app so that it won't work just in console anymore.

Could you please explain what makes this a "console" app, specifically? 
  You are proposing wrapping a GUI around it, which would make it not a 
console app (by definition), so it would help if you specified exactly 
what elements (which functions, etc.) cause you to label it a "console" 
app.  (For example, maybe it calls msvcrt.kbhit/getch or something...)

The reason for asking is that the specifics of your answer will make it 
easier to describe how to modify this "console" so that the relevant 
parts work equally well as a _real_ console app (no GUI) or with the 
GUI.  We could describe it in more general terms, but it might not be 
apparent how to adapt that to your own case.

-Peter




More information about the Python-list mailing list