Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4ce9c0a8034cc5413f9c4b21d8434439204f39665ac33fd4ac4e6b15c47d0317
Ticket: ce6b428620dd89bc46786654e3aa1d62d74d3fc8
<<Increment>> event is endlessly triggered once messagebox closes
User & Date: chrstphrchvz on 2022-02-16 09:58:59
Changes

  1. icomment:
    The reporter may likely need to provide more information; what is the output of <tt>Tk().getvar('tk_patchLevel')</tt> and <tt>Tk().tk.eval('tk windowingsystem')</tt>?
    
    I ran the Tkinter example (need to do <tt>from tkinter import *; from tkinter import ttk, messagebox</tt> first) and did not observe the reporter's issue for Tcl/Tk 8.6.12 on X11. However if I tweak Francois' Tcl example to resemble the reporter's Tkinter a little more (no separate toplevel, show a messagebox, focus on the spinbox afterward):
    
    <pre>
    package require Tk
    set max_length 10
    set check_length_calls 0
    set input 0
    proc check_length {} {
      global check_length_calls max_length
      incr check_length_calls
      if {&#91;focus&#93; ne ".s"} {return}
      if {&#91;.s get&#93; == $max_length} {
        tk_messageBox -title "Max length reached" -message "Too long!" -icon warning
        focus .s
      }
    }
    wm geometry . 300x100
    ttk::label .l -text "Quantity: "
    ttk::spinbox .s -from 0 -to 10 -textvariable input
    bind .s &lt;&lt;Increment&gt;&gt; {check_length}
    ttk::button .b -text "Print fun calls" -command {puts $check_length_calls}
    pack .l .s .b
    </pre>
    
    …then I do observe that every time the messagebox is dismissed, another will appear shortly. But I wonder if this behavior is intentional/as documentation would suggest, and just something Tk programs need to beware.
    
  2. login: "chrstphrchvz"
  3. mimetype: "text/x-fossil-wiki"