Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Tk/Tcl version conflict #379

Copy link
Copy link

Description

@mpheath
Issue body actions

PS v3.0.21.0 x64

Details

bug.py:

import tkinter
tkinter.Tk()

output:

Traceback (most recent call last):
  File "C:\Programs\Notepad++\plugins\Config\PythonScript\scripts\Tests\bug.py", line 8, in <module>
    tkinter.Tk()
  File "C:\Programs\Notepad++\plugins\PythonScript\lib\tkinter\__init__.py", line 2346, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
    C:/Programs/Notepad++/plugins/PythonScript/lib/tcl8.6 C:/Programs/lib/tcl8.6 C:/lib/tcl8.6 C:/Programs/library C:/library C:/tcl8.6.15/library C:/tcl8.6.15/library

C:/Programs/Notepad++/plugins/PythonScript/lib/tcl8.6/init.tcl: version conflict for package "Tcl": have 8.6.15, need exactly 8.6.13
version conflict for package "Tcl": have 8.6.15, need exactly 8.6.13
    while executing
"package require -exact Tcl 8.6.13"
    (file "C:/Programs/Notepad++/plugins/PythonScript/lib/tcl8.6/init.tcl" line 19)
    invoked from within
"source C:/Programs/Notepad++/plugins/PythonScript/lib/tcl8.6/init.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list source $tclfile]"


This probably means that Tcl wasn't installed properly.

package require -exact Tcl 8.6.13

package require -exact Tk 8.6.13

Changing both require version strings to 8.6.15 avoids error.

Inside _tkinter binary is a string:

D:\a\1\s\externals\tcltk-8.6.15.2\amd64\lib\tcl8.6

Same string in PS v3.0.20.0 _tkinter binary.

PS v3.0.19.0 _tkinter binary has a different string:

D:\a\1\s\externals\tcltk-8.6.13.0\amd64\lib\tcl8.6

Appears that PS v3.0.19.0 is the last v3 version which matches the Tk/Tcl requirement of exactly 8.6.13 .

Downloaded tk8.6.15 source from SourceForge and compared tk.tcl with v3.0.21.0

Details
@@ -11,7 +11,7 @@
 # this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
 # Verify that we have Tk binary and script components from the same release
-package require -exact Tk  8.6.13
+package require -exact Tk  8.6.15
 
 # Create a ::tk namespace
 namespace eval ::tk {
@@ -178,16 +178,21 @@
 
     catch {focus $oldFocus}
     grab release $grab
-    if {$destroy eq "withdraw"} {
-	wm withdraw $grab
-    } else {
-	destroy $grab
+    if {[winfo exists $grab]} {
+	if {$destroy eq "withdraw"} {
+	    wm withdraw $grab
+	} else {
+	    destroy $grab
+	}
     }
     if {[winfo exists $oldGrab] && [winfo ismapped $oldGrab]} {
+	# The "grab" command will fail if another application
+	# already holds the grab on a window with the same name.
+	# So catch it. See [7447ed20ec] for an example.
 	if {$oldStatus eq "global"} {
-	    grab -global $oldGrab
+	    catch {grab -global $oldGrab}
 	} else {
-	    grab $oldGrab
+	    catch {grab $oldGrab}
 	}
     }
 }
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.