wingrass: launching gui and shell [was: Re: [GRASS-dev] Wingrass
and TclTk]
Glynn Clements
glynn at gclements.plus.com
Mon Nov 5 16:13:08 EST 2007
Moritz Lennert wrote:
> >>> The "start" command has a flag to hide the console window.
> >> That is what Benjamin and I suggested to use. However, Paul is right
> >> that we currenly need a cmd session to remain open in order to do the
> >> clean up work at the end. And whichever way I turn the issue, I haven't
> >> been able to find a satisfying solution, yet. For more details, see
> >> towards the end of
> >> http://grass.itc.it/pipermail/grass5/2007-November/033889.html - from
> >> "Yes. I had forgotten about all that")
> >
> > Is it not possible to "start" a batch file which runs gis.m in the
> > foreground then deletes the files when it terminates? Or does that
> > still open a console window?
>
> Yes, that is actually the "definition" of start (from
> http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true):
>
> "Starts a separate Command Prompt window to run a specified program or
> command."
>
> There is a flag /min to minimize this new window. There is also a flag
> /b ("Starts an application without opening a new Command Prompt
> window"). This opens the application in the current window...
>
> But the problem is not launching gis.m without a terminal. That's quite
> easy. The problem is that launching grass63.bat automatically opens a
> terminal and that it is difficult to get rid of that, unless we follow
> your suggestion and have different .bat files for launching grass with
> or without gui.
I think that different files for text vs GUI is probably going to be a
good idea for other reasons. I'm not sure what reasons exactly, but
Windows makes a distinction between console-mode and GUI executables
(unlike Unix, where X is just another library).
Also, the console for a batch file isn't necessarily a problem if the
batch file terminates as soon as it has spawned the GUI. The issue is
whether it's possible to spawn another batch file with /b then quit.
If that's possible, the spawned batch file can deal with clean-up.
> As I wrote in the mail mentioned above:
>
> > One option would be to use the start command in grass63.bat, such as:
> >
> > start /min cmd /c "%WINGISBASE%\etc\init.bat" %*
> >
> > It spawns a new minimized cmd.exe which then runs init.bat. This works
> > great for GUI startup, but when you launch grass63.bat -text, you have the
> > incovenience of a) another cmd window open for grass and b) you have to
> > maximize the window to be able to enter grass. And since the 'text' option
> > can come from the .grassrc6 file, we cannot count on a '-text' parameter
> > being available in grass63.bat.
>
> So, if we use two different grass63.bat files (or we parse the command
> line and .grassrc6 in grass63.bat), this option seems the easiest. It
> actually opens a cmd.exe window but this is minimized and so you only
> see it in the task bar (would be great to be able to get rid of that as
> well, but that should be acceptable - don't know if it is possible to
> hide a program from the task bar).
>
> One option would be to create a gui launching script in another language
> (i.e. C, tcl, etc) so that it doesn't automatically provoke the launch
> of a cmd window.
Right. "wish" should be a GUI application, so a Tcl/Tk script run via
wish shouldn't open a new console. The script doesn't have to actually
use Tk. Actually, it wouldn't surprise me if tclsh was a GUI
application, to allow loading Tk dynamically.
Requiring Tcl/Tk isn't an issue for a script which is meant to launch
gis.m.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list