Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73343

Python Noob, open file dialog

Newsgroups comp.lang.python
Date 2014-06-17 09:49 -0700
Message-ID <94cdb6dd-9071-4006-89b2-c84d6bd757b6@googlegroups.com> (permalink)
Subject Python Noob, open file dialog
From cutey Love <cuteywithlove@gmail.com>

Show all headers | View raw


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?

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()

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Python Noob, open file dialog cutey Love <cuteywithlove@gmail.com> - 2014-06-17 09:49 -0700
  Re: Python Noob, open file dialog MRAB <python@mrabarnett.plus.com> - 2014-06-17 18:34 +0100
    Re: Python Noob, open file dialog cutey Love <cuteywithlove@gmail.com> - 2014-06-18 00:36 -0700
      Re: Python Noob, open file dialog Chris Angelico <rosuav@gmail.com> - 2014-06-18 17:45 +1000
      Re: Python Noob, open file dialog alister <alister.nospam.ware@ntlworld.com> - 2014-06-18 08:32 +0000
        Re: Python Noob, open file dialog cutey Love <cuteywithlove@gmail.com> - 2014-06-18 02:03 -0700
          Re: Python Noob, open file dialog Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-18 14:10 +0100

csiph-web