Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73343 > unrolled thread
| Started by | cutey Love <cuteywithlove@gmail.com> |
|---|---|
| First post | 2014-06-17 09:49 -0700 |
| Last post | 2014-06-18 14:10 +0100 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.python
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
| From | cutey Love <cuteywithlove@gmail.com> |
|---|---|
| Date | 2014-06-17 09:49 -0700 |
| Subject | Python Noob, open file dialog |
| Message-ID | <94cdb6dd-9071-4006-89b2-c84d6bd757b6@googlegroups.com> |
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()
[toc] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2014-06-17 18:34 +0100 |
| Message-ID | <mailman.11108.1403026493.18130.python-list@python.org> |
| In reply to | #73343 |
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()
>
[toc] | [prev] | [next] | [standalone]
| From | cutey Love <cuteywithlove@gmail.com> |
|---|---|
| Date | 2014-06-18 00:36 -0700 |
| Message-ID | <68cd5f3f-94d8-4c44-8b4f-28961bf1186d@googlegroups.com> |
| In reply to | #73344 |
No it's still paused after selection and only excutes when the window is closed.
On Tuesday, June 17, 2014 6:34:41 PM UTC+1, MRAB wrote:
> 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()
>
> >
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-06-18 17:45 +1000 |
| Message-ID | <mailman.11112.1403077536.18130.python-list@python.org> |
| In reply to | #73352 |
On Wed, Jun 18, 2014 at 5:36 PM, cutey Love <cuteywithlove@gmail.com> wrote: > No it's still paused after selection and only excutes when the window is closed. Treat the file dialog exactly the way you would in a text editor or word processor. Does your program continue as normal then? If not, please be really specific - for instance: """I bring up the file dialog, and I click on a file and press OK. It doesn't close the dialog like I would normally expect, and I have to press Cancel to make the dialog close - but then it works like OK ought to.""" Is that what's going on? (I have seen dialogs, and written some too, with this exact bug. But I'd be very surprised if it's the case with a standard file-open box.) If not, please be at least as detailed as the above. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | alister <alister.nospam.ware@ntlworld.com> |
|---|---|
| Date | 2014-06-18 08:32 +0000 |
| Message-ID | <I8cov.90230$Uc5.28934@fx09.am4> |
| In reply to | #73352 |
On Wed, 18 Jun 2014 00:36:29 -0700, cutey Love wrote:
> No it's still paused after selection and only excutes when the window is
> closed.
>
> On Tuesday, June 17, 2014 6:34:41 PM UTC+1, MRAB wrote:
>> 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()
I have just tested your sample code & it works fine for me.
Fedora 20
Python 2.7.5
What is your environment
Please also see the various comments regarding top posting & google groups
--
Are you scared of speed? If so, then try Windows 95.
[toc] | [prev] | [next] | [standalone]
| From | cutey Love <cuteywithlove@gmail.com> |
|---|---|
| Date | 2014-06-18 02:03 -0700 |
| Message-ID | <8b26e28f-2124-4c13-83ff-ec081ad5265c@googlegroups.com> |
| In reply to | #73354 |
I'm on windows, I'm going to uninstall python and reinstall
On Wednesday, June 18, 2014 9:32:40 AM UTC+1, alister wrote:
> On Wed, 18 Jun 2014 00:36:29 -0700, cutey Love wrote:
>
>
>
> > No it's still paused after selection and only excutes when the window is
>
> > closed.
>
> >
>
> > On Tuesday, June 17, 2014 6:34:41 PM UTC+1, MRAB wrote:
>
> >> 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()
>
>
>
> I have just tested your sample code & it works fine for me.
>
>
>
> Fedora 20
>
> Python 2.7.5
>
>
>
> What is your environment
>
>
>
> Please also see the various comments regarding top posting & google groups
>
>
>
>
>
>
>
>
>
> --
>
> Are you scared of speed? If so, then try Windows 95.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-06-18 14:10 +0100 |
| Message-ID | <mailman.11116.1403097024.18130.python-list@python.org> |
| In reply to | #73355 |
On 18/06/2014 10:03, cutey Love wrote: > I'm on windows, I'm going to uninstall python and reinstall > > On Wednesday, June 18, 2014 9:32:40 AM UTC+1, alister wrote: >> >> Please also see the various comments regarding top posting & google groups >> Please note that if you carry on top posting and (mis)using google groups you will not be regarded as cutey Love by me :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web