Hi Eric,
It seems you don't understand how GUI development work. The command I
mentioned before, i.e.
%gui tk
is necessary to activate something called the Tk event loop. That's what
allows you running Python files that create Tk graphical interfaces
without blocking the IPython Console, i.e. it allows you to keep running
things in the console while your interface is running in the background.
That's not a Spyder limitation, it's somethings that needs to be done
for every graphical application you're trying to develop and every
toolkit you're using (because Tk is not the only GUI toolkit available :-).
However, there's a way to set the Tk event loop without running that
little command. For that you need to go to
Tools > Preferences > IPython Console > Graphics > Graphics backend
and select
Tk
there.
Cheers,
Carlos
El 03/04/16 a las 13:59, Eric Shain escribió:
While I appreciate the response, it isn't all that satisfying. Are you
saying that Tk code is never going to work in Spyder? I like
developing in Spyder because of its various features. Having to switch
to a different editor if I want to use Tk would be annoying.
Eric
On Friday, March 25, 2016 at 11:00:05 AM UTC-7, Carlos Córdoba wrote:
Hi,
You need to use the IPython Console to run your code, but before
doing it, please run this command there:
%gui tk
Cheers,
Carlos
El 25/03/16 a las 12:55, Eric Shain escribió:
Its been several days and no one has commented on my question. Is
there a better venue to post this?
Eric
On Monday, March 21, 2016 at 7:16:34 PM UTC-5, Eric Shain wrote:
Using Spyder2 with Python 3.5 on a Macintosh, I'm having
trouble with Tk. Specifically I'm trying to use Tk to
generate a open file dialog. Here is what I type:
import tkinter as tk
from tkinter.filedialog import askopenfilename
root = tk.Tk()
At this point, everything freezes. I get a little spinning
icon and I have to force quit. This all works (and more) from
a separate ipython console but either typed interactively or
run from a file within spyder, it causes spyder to freeze up.
Any idea of how to fix this? I should mention I'm using the
Anaconda installed version of Spyder2.
Many thanks,
Eric
--
You received this message because you are subscribed to the
Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected] <javascript:>.
To post to this group, send email to [email protected]
<javascript:>.
Visit this group at https://groups.google.com/group/spyderlib
<https://groups.google.com/group/spyderlib>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.