Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'subject:Python': 0.06; 'subject:file': 0.07; 'tkinter': 0.07; 'def': 0.12; '"test"': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'function?': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'file,': 0.19; 'skip:f 30': 0.19; 'select': 0.22; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'lets': 0.24; 'header :In-Reply-To:1': 0.27; "i'm": 0.30; 'code': 0.31; 'dialog': 0.31; 'skip:m 30': 0.32; 'open': 0.33; 'continuing': 0.33; 'problem': 0.35; 'except': 0.35; 'button': 0.38; 'window': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:t 30': 0.61; 'full': 0.61; 'first': 0.61; 'such': 0.63; 'confirm': 0.64; 'love': 0.65; 'great': 0.65; 'click': 0.77; 'completes': 0.84; 'opens': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=OZcWD3jY c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=u9EReRu7m0cA:10 a=WDzLqx0gqhQA:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=IZ_zwq_VHM3yAV3qfacA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Tue, 17 Jun 2014 18:34:41 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python Noob, open file dialog References: <94cdb6dd-9071-4006-89b2-c84d6bd757b6@googlegroups.com> In-Reply-To: <94cdb6dd-9071-4006-89b2-c84d6bd757b6@googlegroups.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1403026493 news.xs4all.nl 2843 [2001:888:2000:d::a6]:58692 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73344 On 2014-06-17 17:49, cutey Love wrote: > My first attempt at Python, > > I'm using Tkinter and all is going well except when I'm using > > file_path = tkFileDialog.askopenfilename() > print "test" > > opens great and lets me select a file, the problem is it then pauses? instead of continuing with the function? until I close, then it goes and completes the function? > > Why is this and how do I fix it? > It's waiting for you to click the Open button to confirm your selection. That's normal behaviour for such a dialog box. > Full code > > import Tkinter, tkFileDialog > > from Tkinter import * > > emails = [] > > def askFile(): > file_path = tkFileDialog.askopenfilename() > print "test" > > > window = Tkinter.Tk() > window.title("Super Star") > > window.geometry("600x600") > > menubar = Menu(window) > filemenu = Menu(menubar, tearoff=0) > filemenu.add_command(label="New", command=askFile) > > menubar.add_cascade(label="File", menu=filemenu) > > window.config(menu=menubar) > > window.mainloop() >