FAQ
Hi folks,
I've got the following problem running a python20/ tcl8.3.2 Tkinter
application
in python shell IDLE 0.6 under windows 2000SP1.

My programm generates a window with a button.
When pushing the button the program should terminate, but
tk.mainloop() doesn't.
The problem only appear running the program under python shell IDLE
0.6.
Running the program with the command line interpreter is working
correctly.

where is the error?
who knows an answer?

Thanks a lot
Stefan

------ Sample Code ----------
import Tkinter
from Tkconstants import *
tk = Tkinter.Tk()
frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
button = Tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()
-----------------------------

Search Discussions

  • Stefan kusch at May 3, 2001 at 9:51 am
    Hi folks,
    I've got the following problem running a python20/ tcl8.3.2 Tkinter
    application
    in python shell IDLE 0.6 under windows 2000SP1.

    My programm generates a window with a button.
    When pushing the button the program should terminate, but
    tk.mainloop() doesn't.
    The problem only appear running the program under python shell IDLE
    0.6.
    Running the program with the command line interpreter is working
    correctly.

    where is the error?
    who knows an answer?

    Thanks a lot
    Stefan

    ------ Sample Code ----------
    import Tkinter
    from Tkconstants import *
    tk = Tkinter.Tk()
    frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
    frame.pack(fill=BOTH,expand=1)
    button = Tkinter.Button(frame,text="Exit",command=tk.destroy)
    button.pack(side=BOTTOM)
    tk.mainloop()
    -----------------------------
  • Stefan kusch at May 3, 2001 at 10:00 am
    Hi folks,
    I've got the following problem running a python20/ tcl8.3.2 Tkinter
    application
    in python shell IDLE 0.6 under windows 2000SP1.

    My programm generates a window with a button.
    When pushing the button the program should terminate, but
    tk.mainloop() doesn't.
    The problem only appear running the program under python shell IDLE
    0.6.
    Running the program with the command line interpreter is working
    correctly.

    where is the error?
    who knows an answer?

    Thanks a lot
    Stefan

    ------ Sample Code ----------
    import Tkinter
    from Tkconstants import *
    tk = Tkinter.Tk()
    frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
    frame.pack(fill=BOTH,expand=1)
    button = Tkinter.Button(frame,text="Exit",command=tk.destroy)
    button.pack(side=BOTTOM)
    tk.mainloop()
    -----------------------------
  • Anton Vredegoor at May 3, 2001 at 9:12 pm

    On Thu, 03 May 2001 10:00:44 GMT, stefan2k1de at yahoo.de (stefan kusch) wrote:

    Hi folks,
    I've got the following problem running a python20/ tcl8.3.2 Tkinter
    application
    in python shell IDLE 0.6 under windows 2000SP1.

    My programm generates a window with a button.
    When pushing the button the program should terminate, but
    tk.mainloop() doesn't.
    The problem only appear running the program under python shell IDLE
    0.6.
    Running the program with the command line interpreter is working
    correctly.

    where is the error?
    who knows an answer?
    Your program and Idle are sharing some tk-resources.
    Thanks a lot
    Stefan

    ------ Sample Code ----------
    import Tkinter
    from Tkconstants import *
    tk = Tkinter.Tk()
    frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
    frame.pack(fill=BOTH,expand=1)
    button = Tkinter.Button(frame,text="Exit",command=tk.destroy)
    button.pack(side=BOTTOM)
    tk.mainloop()
    -----------------------------
    Try this :

    import Tkinter
    from Tkconstants import *
    import sys, types

    _inidle = type(sys.stdin) == types.InstanceType and \
    sys.stdin.__class__.__name__ == 'PyShell'

    tk = Tkinter.Tk()
    frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
    frame.pack(fill=BOTH,expand=1)
    button = Tkinter.Button(frame,text="Exit",command=tk.destroy)
    button.pack(side=BOTTOM)

    if not _inidle:
    tk.mainloop()

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 3, '01 at 9:45a
activeMay 3, '01 at 9:12p
posts4
users2
websitepython.org

2 users in discussion

Stefan kusch: 3 posts Anton Vredegoor: 1 post

People

Translate

site design / logo © 2022 Grokbase