Program termination problem

Garyr garyr at fidalgo.net
Thu Mar 28 14:17:16 EST 2002


I have a program that displays a Tkinter Text widget. I would like to be
able to place text in the window via the clipboard. I found the following
clipboard code in a Google post:

import win32clipboard as clip
         ...
        clip.OpenClipboard(0)
        if clip.IsClipboardFormatAvailable(clip.CF_TEXT):
           newText = clip.GetClipboardData(clip.CF_TEXT)
          textwidget.insert(END, newText)
        clip.CloseClipboard()

This works but it causes the program to hang on exit. mainloop() returns but
the DOS window is frozen. The problem is associated with the clipboard
functions; i.e., commenting the insert line has no effect.

I'm using Python 2.1 (Pythonwin 2.1.211) on Win98.
Any suggestions?

Thanks in advance,
Gary Richardson










More information about the Python-list mailing list