Re: tkFileDialog.askopenfile() mac

Kevin Walzer <[email protected]>
Newsgroups gmane.comp.python.tkinter
Organization WordTech Communications LLC
Message-ID <[email protected]>
Hi,
On 8/12/14, 10:23 AM, JBB wrote:
> After some more digging, I find that Python uses the macosx backend on
> initialization.  If I change this to tk before beginning work, the
> problem goes away.  My Linux Python uses tk by default.

What do you mean by this? On Mac, Tkinter/Tk uses native dialogs and 
widgets by default. What change did you make to get it to work on the Mac?

I did see the dialog hanging on the Mac. My guess is that you weren't 
giving the event loop enough time to spin; the dialog was popping up too 
fast. This code works just fine:

from Tkinter import *
import tkFileDialog
root = Tk()
def openfile():
     tkFileDialog.askopenfilename(parent=root)
b = Button(root, text="Open", command=openfile).pack()
root.mainloop()

--Kevin

-- 
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.