emacs: Inferior-mode python-shell appears "lagged"

Posted by Begbie00 on Stack Overflow See other posts from Stack Overflow or by Begbie00
Published on 2010-05-18T21:08:28Z Indexed on 2010/05/18 21:40 UTC
Read the original article Hit count: 284

Filed under:
|

Hi all -

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

© Stack Overflow or respective owner

Related posts about python

Related posts about emacs