On Jun 26, 1:06 am, Fabrizio Pollastri <pollas...@iriti.cnr.it> wrote:
> in mixed python-tcl programming I found the following different
> behaviours of the same tcl script.
> If I type manually in the python interpreter the following lines
> >>> from Tkinter import *
> >>> w = Tk()
> >>> w.tk.evalfile('my_tcl_script.tcl')
> where my_tcl_script.tcl is
> package require Tk
> wm withdraw .
> toplevel .root
> wm title .root "My title"
> I obtain one toplevel window with title "My title", as expected.
> The same result is obtained with the tcl shell command
> % wish my_tcl_script.tcl
> Now, I wish to run the same instructions from a python script. So, I
> written the following script
> from time import *
> from Tkinter import *
> w = Tk()
> I expected to see the same toplevel window for 3 seconds, but the result
> of this python script is nothing, no window appears.
> If anybody can explain the different behaviour and how to normalize it
> with the correct one, I will be very glad. Thank you in advance.
> F. Pollastri
You need a call to `w.mainloop()`
w.after(3000, lambda: w.quit())