Tk Source Code

View Ticket
Login
Ticket UUID: 06972abb14f087454ea3de83c25046e48959ae6d
Title: mac os x: native file dialog does not exit
Type: Bug Version: 8.6.4
Submitter: anonymous Created on: 2015-11-29 18:07:28
Subsystem: 37. [tk_get*File] Assigned To: kevin_walzer
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2016-01-09 03:09:47
Resolution: Fixed Closed By: kevin_walzer
    Closed on: 2016-01-09 03:09:47
Description:
  package require Tk 
  set fn [tk_getOpenFile -parent . ]
  puts "fn:$fn"

After selecting a file, the mac file dialog stays open.  It has no close button, and is inactive thereafter.
User Comments: kevin_walzer added on 2016-01-09 03:09:47:
Commit 43590ff8 seems to have fixed this. Closing.

anonymous (claiming to be [email protected]) added on 2015-12-10 04:23:08:
My application already has windows open and displayed long before the dialog is started.

It's odd.  The dialog displays, I select a file, the dialog goes away.  Another program is started, and I select the button there and it exits.

And then the greyed out file dialog comes back and gets displayed.

Tried putting in an update before the tk_getOpenFile and no help.

It's a weird one.

kevin_walzer added on 2015-12-10 03:39:27:
It appears to be a case of the dialog being drawn before the main window--sort of a race condition. I am not certain of how to address this at the C level, but the fix at the script level is trivial. Just run "update" or some other command to make sure the toplevel has focus. I'm inclined to close this.

anonymous (claiming to be [email protected]) added on 2015-11-30 13:26:40:
   package require Tk
   update
   set fn [tk_getOpenFile -parent .]
   puts "fn:$fn"

Fixes the simple test case, as it prevents the file dialog from opening before the main window.

My application is still failing with these symptoms without any withdrawn or minimized windows and I don't know how to make a simple test case for it.

kevin_walzer added on 2015-11-29 23:25:51:
After seeing your query on c.l.t, it made me wonder if you were using the native dialog or the script-based one. I can reproduce the error with the script-based one, but not the native one. I'm not familiar with the internals of the script-based dialog, alas.

kevin_walzer added on 2015-11-29 22:00:00:
It doesn't appear you are using trunk. Perhaps this bug has been fixed?

anonymous added on 2015-11-29 19:51:53:
I can reproduce it consistently.
Either activestate tcl/tk 8.6.4.1
Or MacPorts 8.6.4

anonymous added on 2015-11-29 19:31:11:
This is on El Capitan.
ActiveState Tk 8.6.4.1
or MacPorts Tk.

I recently upgraded from Yosemite, and I don't recall this issue on Yosemite, but then again, I was not testing my product as thoroughly.  I'm going to try a reboot and also try removing macports tk and reinstalling activestate tk in case there's some weird conflict going on.

kevin_walzer added on 2015-11-29 19:13:28:
I can't reproduce this on 10.11. Works as expected. What version of the OS are you on? Are you using latest trunk build, which is what I am using?