[GRASS5] Re: [GRASSLIST:8729] Re: r.reclass not working in GUI
Michael Barton
michael.barton at asu.edu
Sun Oct 23 12:47:16 EDT 2005
For simple yes/no or other questions, you can use the MessageDlg widget from
bwidgets.
Here is a simple procedure to accept input (e.g., from stdout of a grass
procedure redirected to variable msgtxt), pop up a message dialog with
yes/no buttons, and return 1 or 0 depending on whether you push the yes or
no button.
proc message_dialog { msgtxt } {
set msg [MessageDlg .msgdlg \
-title "The Message Dialog" \
-message $msgtxt \
-type yesno ]
if { $msg == 1 } {puts "no way" }
if { $msg == 0 } {puts "way to go"}
}
For more complicated situations like r.reclass or r.colors, there is
probably a way to make a text widget do what is necessary. I don't really
understand how to implement the wide variety of options for text widgets,
but from what I can glean from the docs (see
<http://aspn.activestate.com/ASPN/docs/ActiveTcl/tcl/TkCmd/text.htm>), it
looks like you could construct an interactive interface like what is done in
the xterminal at present.
FWIW, TclTk is a very rich interface development environment (like several
others) of which GRASS uses only a very limited subset of its potential.
Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
> From: Hamish <hamish_nospam at yahoo.com>
> Date: Sun, 23 Oct 2005 16:42:43 +1300
> To: Glynn Clements <glynn at gclements.plus.com>
> Cc: grass5 <grass5 at grass.itc.it>
> Subject: [GRASS5] Re: [GRASSLIST:8729] Re: r.reclass not working in GUI
>
>> g.mremove is never run in a terminal; if you are using it from the
>> GUI, you will have to enable the "force removal" option, as there's no
>> way to respond to the prompt.
>
>
> Any thoughts on how to get G_yes() to spawn a Yes|No GUI much like
> G_percent() figures to do a Tcl thing instead of a stderr thing if it
> detects it is being run from a GUI environment? Same goes for G_ask_*(),
> but I'm not sure how much those are used anymore.
>
> This would help cut down on the number of xterm kludges that d.m now
> needs for various modules. Or more probably cut down on the number of
> bugs like g.mremove from GUI now has.
>
>
> Hamish
>
>
>
More information about the grass-dev
mailing list