Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] tk_tunnel define proc inside rexec #753

Open
Nabav opened this issue Mar 14, 2022 · 0 comments
Open

[question] tk_tunnel define proc inside rexec #753

Nabav opened this issue Mar 14, 2022 · 0 comments

Comments

@Nabav
Copy link

Nabav commented Mar 14, 2022

This is a question about Tcl scope using Tk commands over tk_tunnel.

I want to have a push running a proc.

rexec {
  proc onClick {} {
    global selected
    if {$selected==true} {
      wm title . checkbutton
    } else {
      wm title . ""
    }
  }
  puts "Starting GUI..."
  tk::toplevel .window
  tk::frame .window.fr
  pack .window.fr -fill both -expand 1
  tk::text .window.fr.tx -width 20 -height 1
  tk::button .window.fr.pb -text "Hi" -width 10 -height 1 -command onClick
  tk::checkbutton .window.fr.cb -text "Show title" -command onClick \
    -onvalue true -offvalue false -variable selected
  .window.fr.cb select
  place .window.fr.cb -x 50 -y 50
  place .window.fr.tx -x 50 -y 80
  place .window.fr.pb -x 50 -y 10
  wm title .window "My Tool"
  wm geometry .window 350x250+300+300
}

I want to run the callback procedure when some widget is clicked.

Please help me with managing the scope. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant