I'm a Python(3.1.2)/emacs(23.2) newbie teaching myself tkinter using the pythonware tutorial found here. Relevant code is pasted below the question.
Question: when I click the Hello button (which should call the say_hi function) why does the inferior python shell (i.e. the one I kicked off with C-c C-c) wait to execute the say_hi print function until I either a) click the Quit button or b) close the root widget down? When I try the same in IDLE, each click of the Hello button produces an immediate print in the IDLE python shell, even before I click Quit or close the root widget.
Is there some quirk in the way emacs runs the Python shell (vs. IDLE) that causes this "lagged" behavior? I've noticed similar emacs lags vs. IDLE as I've worked through Project Euler problems, but this is the clearest example I've seen yet.
FYI: I use python.el and have a relatively clean init.el...
(setq python-python-command "d:/bin/python31/python")
is the only line in my init.el.
Thanks,
Mike
=== Begin Code===
from tkinter import *class App:def __init__(self,master):frame = Frame(master)frame.pack()self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)self.button.pack(side=LEFT)self.hi_there = Button(frame, text="Hello", command=self.say_hi)self.hi_there.pack(side=LEFT)def say_hi(self):print("hi there, everyone!")root = Tk()app = App(root)root.mainloop()