Greg Hoyle | 13 Nov 10:01 2006
Picon

Python shell still running after program has been terminated

Howdy,

While making a small program using python 2.4.4, I have run into a problem getting the python shell to stop running the program. I am not certain of what the problem could be and i'm wondering if there's a way that I can avoid encountering this problem in the future. The details are below.

I can run the program (I normally use F5) without any problems, once; however, when I try to run it again (with or without new changes made to the code), I get an error window that states "Already Executing: The Python Shell window is already executing a command; please wait until it is finished." This window appears twice (back to back) then this is printed out in the shell window:

________________________________________________________________
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
  File "C:\Python24\lib\idlelib\ScriptBinding.py", line 166, in run_module_event
    interp.runcode(code)
  File "C:\Python24\lib\idlelib\PyShell.py", line 697, in runcode
    self.interp.restart_subprocess()
AttributeError: ModifiedInterpreter instance has no attribute 'interp'
_________________________________________________________________



Just in case you need it, here's the code that im using that causes this:

###############################################
from Tkinter import *
root = Tk()

listbox = Listbox(root)
listbox.pack()

name_list = ('name1', 'name2', 'name3', 'name4')

for item in name_list:
    listbox.insert(END, item)

print name_list

root.mainloop()
#################################################


Am I missing something? I am using windows xp media center and the file is save as .pyw. I cant think of any other information that you might need. If you do need more, please let me know and i'll provide it.

Thanks for any assitance that you can provide.

Greg

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Gerardo Juarez | 14 Nov 01:32 2006
Picon

Re: Python shell still running after program has been terminated


Hi,

Yes it does that. No, I don't know what causes it but it seems to be an 
interaction with the OS. I assume you are using IDLE.

Have you tried Shell/Restart Shell (Ctrl+F6)? It has worked for me most of 
the times. It is interesting that an application using several threads 
seems easier to stop cleanly.

On Mon, 13 Nov 2006, Greg Hoyle wrote:

> Howdy,
> 
> While making a small program using python 2.4.4, I have run into a problem
> getting the python shell to stop running the program. I am not certain of
> what the problem could be and i'm wondering if there's a way that I can
> avoid encountering this problem in the future. The details are below.
> 
> I can run the program (I normally use F5) without any problems, once;
> however, when I try to run it again (with or without new changes made to the
> code), I get an error window that states "Already Executing: The Python
> Shell window is already executing a command; please wait until it is
> finished." This window appears twice (back to back) then this is printed out
> in the shell window:
> 
> ________________________________________________________________
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
>     return self.func(*args)
>   File "C:\Python24\lib\idlelib\ScriptBinding.py", line 166, in
> run_module_event
>     interp.runcode(code)
>   File "C:\Python24\lib\idlelib\PyShell.py", line 697, in runcode
>     self.interp.restart_subprocess()
> AttributeError: ModifiedInterpreter instance has no attribute 'interp'
> _________________________________________________________________
> 
> 
> 
> Just in case you need it, here's the code that im using that causes this:
> 
> ###############################################
> from Tkinter import *
> root = Tk()
> 
> listbox = Listbox(root)
> listbox.pack()
> 
> name_list = ('name1', 'name2', 'name3', 'name4')
> 
> for item in name_list:
>     listbox.insert(END, item)
> 
> print name_list
> 
> root.mainloop()
> #################################################
> 
> 
> Am I missing something? I am using windows xp media center and the file is
> save as .pyw. I cant think of any other information that you might need. If
> you do need more, please let me know and i'll provide it.
> 
> Thanks for any assitance that you can provide.
> 
> Greg
> 
Kevin Walzer | 13 Nov 22:23 2006

ANN: Martin Franklin's Tile/Tablelist Tkinter wrappers now at SourceForge

I have posted Martin Franklin's Tkinter wrappers for the TableList
package (http://www.nemethi.de/) and the Tile theming extension
(http://tktable.sourceforge.net/tile/) at SourceForge.

Mr. Franklin previously hosted these wrappers at the URL's below:

http://mfranklin.is-a-geek.org/docs/TableList/index.html
http://mfranklin.is-a-geek.org/docs/Tile/index.html

Mr. Franklin had previously announced the wrappers on these lists:

http://mail.python.org/pipermail/tkinter-discuss/2005-January/000302.html
http://mail.python.org/pipermail/tkinter-discuss/2005-March/000365.html

His licensing terms were not explicit, but my reading of the threads
indicates he intended the wrappers to be freely reusable.

I had downloaded the extensions several months ago, intending to try
them out. Since then  Mr. Franklin's site seems to have gone offline,
and the extensions are not available elsewhere. Because they are the
best-available Tkinter wrappers for these two powerful Tk extensions, I
have made them available at a SF site I maintain for various Tk
extensions. The download link is below:

https://sourceforge.net/project/showfiles.php?group_id=165637&package_id=211496&release_id=463359

At present I have only posted the extensions themselves. The only
documentation is that provided by Mr. Franklin in his source code. After
I spend more time using these extensions in an application I am
developing, I will probably update the package with additional
documentation.

If I have misstepped by making these extensions available at SF, I
invite Mr. Franklin to contact me on- or off-list.

--

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Vasilis Vlachoudis | 18 Nov 23:29 2006
Picon
Picon

Canvas cursor position

Dear all,

in my application I am using editable text items inside a Canvas with 
the Canvas.create_text().
My problem is how to find the position (x,y) of the insert cursor from 
an editable text item in a canvas, so when the cursor
goes out of the window to scroll the canvas to see the cursor?
While I can set the cursor with Canvas.icursor(item," <at> %d,%d"%(x,y)), I 
cannot get back the x,y position with the function Canvas.index(item, 
index). It returns only a numerical index of the cursor position.

Vasilis
Pekka Niiranen | 19 Nov 12:06 2006

Tkinter grid manipulation question

Hi,

I found this code from Internet:

from Tkinter import *

rows = []
for i in range(5):
     cols = []
     for j in range(4):
         e = Entry(relief=RIDGE)
         e.grid(row=i, column=j, sticky=N+S+E+W)
         e.insert(END, '%d.%d' % (i, j))
         cols.append(e)
     rows.append(cols)

# print Grid.grid_info(e)

def onPress():
     for row in rows:
         for col in row:
             print col.get(),
         print

Button(text='Fetch', command=onPress).grid()
mainloop()

How can I change its behaviour so that when I hit Enter on current cell
the cursor moves automatically to cell below it?

(I should bind the Enter -button and call <some method>
to adjust current cell location)

-pekka-
Fredrik Lundh | 19 Nov 12:43 2006

Re: Tkinter grid manipulation question

Pekka Niiranen wrote:

> How can I change its behaviour so that when I hit Enter on current cell
> the cursor moves automatically to cell below it?
> 
> (I should bind the Enter -button and call <some method>
> to adjust current cell location)

call focus_set() on the widget that should get focus:

http://effbot.org/tkinterbook/widget.htm#Tkinter.Widget.focus_set-method

</F>
Sorin Schwimmer | 22 Nov 20:33 2006
Picon

Windows beautification

Hi All,

1. I'd like to be able to put an icon on the titlebar. I read about using iconwindow together
with a Label, but how? My code:

from Tkinter import *
import Image,ImageTk

root=Tk()
im=ImageTk.PhotoImage(Image.open("mcut16.png")) # a 16x16 image
lb=Label(root,image=im)
root.iconwindow(lb)

yields the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 1473, in wm_iconwindow
    return self.tk.call('wm', 'iconwindow', self._w, pathName)
_tkinter.TclError: can't use .-1211821748 as icon window: not at top level

How should I do it?

2. I'd like to be able to set the colour of the window decoration. I'd like to distinguish
between similar windows based on their title (and, if possible, border) colour. Can I
accomplish that?

3. Where can I find a detailed documentation about what arguments go in the wm_ family
of  Toplevel methods (meaning, format)?

Thanks,
Sorin

Sponsored Link

Mortgage rates near historic lows: $150,000 loan as low as $579/mo. Intro-*Terms
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Michael Lange | 22 Nov 21:50 2006
Picon

Re: Windows beautification

On Wed, 22 Nov 2006 11:33:05 -0800 (PST)
Sorin Schwimmer <sxn02 <at> yahoo.com> wrote:

> Hi All,
> 
> 1. I'd like to be able to put an icon on the titlebar. I read about using iconwindow together
> with a Label, but how? My code:
> 
> from Tkinter import *
> import Image,ImageTk
> 
> root=Tk()
> im=ImageTk.PhotoImage(Image.open("mcut16.png")) # a 16x16 image
> lb=Label(root,image=im)
> root.iconwindow(lb)
> 
> yields the following error:
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 1473, in wm_iconwindow
>     return self.tk.call('wm', 'iconwindow', self._w, pathName)
> _tkinter.TclError: can't use .-1211821748 as icon window: not at top level
> 
> How should I do it?
> 

I think you need a Toplevel() window instead of a Label.

Michael
Sorin Schwimmer | 22 Nov 22:23 2006
Picon

Re: Windows beautification

> I think you need a Toplevel() window instead of a Label.

> Michael

I'm not sure I understand. Can you illustrate with an example?

Thanks,
Sorin

Everyone is raving about the all-new Yahoo! Mail beta.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Godson | 23 Nov 08:00 2006
Picon

Re: Windows beautification



On 11/23/06, Sorin Schwimmer <sxn02 <at> yahoo.com> wrote:
> I think you need a Toplevel() window instead of a Label.

> Michael

I'm not sure I understand. Can you illustrate with an example?

Thanks,
Sorin

Everyone is raving about the all-new Yahoo! Mail beta.

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss


if all you want is to set icon for a window you can simply do that with the following in code

from Tkinter import*
root=Tk()
root.iconbitmap("c:\\python25\\smiley.ico")

iconbitmap is capable of readiong windows .ico files and it can simply set the icon, so you dont have to go in to all the hacking of label image tk etc etc.


2) The window decoration is drawn by the OS not by the Tkinter.  That window decoration is a kind  of global look and feel that you get for all the windows in your machine as decided by the theme manager. If you still insist on doing that from with Tkinter simply restrict the window manager from decorating your windows. use "overrideredirect"  method on root window

root.overrideredirect(1)

But it has lots of troubles like you cant move the window normally,  for that you have to write additional code.


3) http://effbot.org/tkinterbook/wm.htm
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss <at> python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Gmane