On Sunday, November 6, 2022 at 7:03:49 AM UTC+1, Luc wrote:
I am back to the old problem.
Even if I make a "plain" page instead of a proc, I'd still need to be
able to output something and exit - exit the proc/function, not the
entire application. So the [exit] command is verboten.
Now, either way, there is a part of the proc/application where a new
widget pops up. That widget has to receive input, return it to the
parent application (the one I'm working on) so the parent can proceed.
Hi Luc,
my untested suggestion:
catch {unset ::ops::result}
... -command {set ::ops::result Boom}
and at end of proc instead of the 2 last lines - that end the process -
vwait ::ops::result
destroy $::ops::w
return $::ops::result
there is tk_dialog too, a modal dialog, that blocks interaction with other gui elements, so you won't need to hide the main window.
Roland
I am back to the old problem.
Even if I make a "plain" page instead of a proc, I'd still need to be
able to output something and exit - exit the proc/function, not the
entire application. So the [exit] command is verboten.
Now, either way, there is a part of the proc/application where a new
widget pops up. That widget has to receive input, return it to the
parent application (the one I'm working on) so the parent can proceed.
I wrote this small prototype. Can you make the button return its
output and destroy this entire window?
Please remember this is supposed to be a child window. The parent
window must be kept alive.
namespace eval ::ops {}Hi Luc,
proc ::ops::run {} {
# ----------------- MAKE WINDOW -----------------------
package require Tk
wm withdraw .
eval destroy [winfo children .]
catch {destroy .ops}
set ::ops::w [toplevel .ops]
wm resizable $::ops::w 1 1
# -------------- TEXT BOX --------------
text $::ops::w.textbox
set ::ops::TextBox $::ops::w.textbox
pack $::ops::TextBox -fill both -expand 1 -side left
$::ops::TextBox configure -background #ffffff -foreground #000000 $::ops::TextBox configure -width 30 -height 20
$::ops::TextBox configure -wrap none -font "Freesans 16" -padx 10 -pady 10 $::ops::TextBox configure -cursor arrow
$::ops::TextBox insert end "Some text that is invisible because the box is so small.\n"
$::ops::TextBox insert end "I don't know why the text box is so small."
focus $::ops::TextBox
button $::ops::w.textbox.button
$::ops::w.textbox.button configure -width 5 -height 2 $::ops::w.textbox.button configure -font "Freesans 16" -padx 4 -pady 4 $::ops::w.textbox.button configure -text "Push"
$::ops::w.textbox.button configure -command {return "Boom!"}
pack $::ops::w.textbox.button
bind $::ops::w <Escape> {exit 0}
wm protocol $::ops::w WM_DELETE_WINDOW {exit 0}
}
puts [::ops::run]
--
Luc
I am back to the old problem.
Even if I make a "plain" page instead of a proc, I'd still need to be
able to output something and exit - exit the proc/function, not the
entire application. So the [exit] command is verboten.
Now, either way, there is a part of the proc/application where a new
widget pops up. That widget has to receive input, return it to the
parent application (the one I'm working on) so the parent can proceed.
I wrote this small prototype. Can you make the button return its
output and destroy this entire window?
Please remember this is supposed to be a child window. The parent
window must be kept alive.
namespace eval ::ops {}
proc ::ops::run {} {
# ----------------- MAKE WINDOW -----------------------
package require Tk
wm withdraw .
eval destroy [winfo children .]
catch {destroy .ops}
set ::ops::w [toplevel .ops]
wm resizable $::ops::w 1 1
# -------------- TEXT BOX --------------
text $::ops::w.textbox
set ::ops::TextBox $::ops::w.textbox
pack $::ops::TextBox -fill both -expand 1 -side left
$::ops::TextBox configure -background #ffffff -foreground #000000
$::ops::TextBox configure -width 30 -height 20
$::ops::TextBox configure -wrap none -font "Freesans 16" -padx 10 -pady 10
$::ops::TextBox configure -cursor arrow
$::ops::TextBox insert end "Some text that is invisible because the box is so small.\n"
$::ops::TextBox insert end "I don't know why the text box is so small."
focus $::ops::TextBox
button $::ops::w.textbox.button
$::ops::w.textbox.button configure -width 5 -height 2
$::ops::w.textbox.button configure -font "Freesans 16" -padx 4 -pady 4
$::ops::w.textbox.button configure -text "Push"
$::ops::w.textbox.button configure -command {return "Boom!"}
pack $::ops::w.textbox.button
bind $::ops::w <Escape> {exit 0}
wm protocol $::ops::w WM_DELETE_WINDOW {exit 0}
}
puts [::ops::run]
**************************
On Sunday, November 6, 2022 at 7:03:49 AM UTC+1, Luc wrote:
I am back to the old problem.
Even if I make a "plain" page instead of a proc, I'd still need to be
able to output something and exit - exit the proc/function, not the
entire application. So the [exit] command is verboten.
Now, either way, there is a part of the proc/application where a new
widget pops up. That widget has to receive input, return it to the
parent application (the one I'm working on) so the parent can proceed.
I wrote this small prototype. Can you make the button return its
output and destroy this entire window?
Please remember this is supposed to be a child window. The parent
window must be kept alive.
************************namespace eval ::ops {}
proc ::ops::run {} {
# ----------------- MAKE WINDOW -----------------------
package require Tk
wm withdraw .
eval destroy [winfo children .]
catch {destroy .ops}
set ::ops::w [toplevel .ops]
wm resizable $::ops::w 1 1
# -------------- TEXT BOX --------------
text $::ops::w.textbox
set ::ops::TextBox $::ops::w.textbox
pack $::ops::TextBox -fill both -expand 1 -side left
$::ops::TextBox configure -background #ffffff -foreground #000000 $::ops::TextBox configure -width 30 -height 20
$::ops::TextBox configure -wrap none -font "Freesans 16" -padx 10 -pady
10 $::ops::TextBox configure -cursor arrow
$::ops::TextBox insert end "Some text that is invisible because the box
is so small.\n" $::ops::TextBox insert end "I don't know why the text
box is so small." focus $::ops::TextBox
button $::ops::w.textbox.button
$::ops::w.textbox.button configure -width 5 -height 2 $::ops::w.textbox.button configure -font "Freesans 16" -padx 4 -pady 4 $::ops::w.textbox.button configure -text "Push"
$::ops::w.textbox.button configure -command {return "Boom!"}
pack $::ops::w.textbox.button
bind $::ops::w <Escape> {exit 0}
wm protocol $::ops::w WM_DELETE_WINDOW {exit 0}
}
puts [::ops::run]
--Hi Luc,
Luc
my untested suggestion:
catch {unset ::ops::result}
... -command {set ::ops::result Boom}
and at end of proc instead of the 2 last lines - that end the process -
vwait ::ops::result
destroy $::ops::w
return $::ops::result
there is tk_dialog too, a modal dialog, that blocks interaction with
other gui elements, so you won't need to hide the main window. Roland
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 40:18:11 |
| Calls: | 12,109 |
| Files: | 15,006 |
| Messages: | 6,518,397 |