Strange Tkinter behaviour - new facts!

Tomasz Lisowski jtlispl at poczta.NOSPAM.onet.pl
Sat Dec 1 02:01:43 EST 2001


U¿ytkownik "Tomasz Lisowski" <jtlispl at poczta.NOSPAM.onet.pl> napisa³ w
wiadomo¶ci news:9u5l8i$dh9$1 at news.onet.pl...
> Uzytkownik "Laura Creighton" <lac at strakt.com> napisal w wiadomosci
> news:mailman.1007040459.25437.python-list at python.org...
> > Try calling update_idletasks().  On occasion I have had that work
> > when update() didn't.
> >
> > Laura Creighton
>
> Unfortunately, it did not help in my case. The text is displayed in the
> drawing only after the button is clicked again, even if update_idletasks()
> is called.
>
> I wonder, whether there is a mechanism suspending the Tkinter event loop,
so
> that other event-based applications (not using Tkinter) could get access,
> and perform their duties.
>
> Tomasz Lisowski

I suspected a problem with interaction between Tkinter and native module
provided by the CAD system producer for access to the drawing being created.

I have observed two typical behaviours:

Sequence A
------------
1. Tkinter window appears on the screen, and the event loop is running
2. A button is clicked, which invokes a method adding a text to the drawing
    2a. The Tkinter window is withdrawn
    2b. The insertion point is indicated (native module used!)
    2c. The first text is placed in the drawing (native module used!), but
does not appear immediately
    2d. The Tkinter window is deiconified
3. A button adding a text to the drawing is clicked AGAIN.
    3a. The Tkinter window is withdrawn
    3b. While asking for the insertion point I see the text added in step 2
appear on the screen. Then I can click on the screen and indicate the place
for the second text (native module used!)
    3c. The second text is placed in the drawing (native module used!), but
does not appear immediately
    3d. The Tkinter window is deiconified
4. etc.

Sequence B
------------
1. Tkinter window appears on the screen, and the event loop is running
2. A button is clicked, which invokes a method adding a text to the drawing
    2a. The Tkinter window is withdrawn
    2b. The insertion point is indicated (native module used!)
    2c. The first text is placed in the drawing (native module used!)
    2d. I use ANY function from the native module, that displays a window on
the screen (e.g. a function displaying a message). This makes the text
inserted in step 2c appear on the drawing. Since this occurrs very quickly
after the ste[ 2c, the user notices no delay in placing of the text, but he
is forced to dismiss the additional message window in order to continue
working
    2e. The Tkinter window is deiconified
3. etc.

As you can see, using a function from the native module, that displays any
window (e.g. a message window), or asks for a point in the drawing (this
works too!) refreshes somehow the drawing. Without this additional step, the
text added to the drawing appears only, when a new text is added (while
indicating an insertion point), or when the window is closed.

Any comments, hints?

Tomasz Lisowski





More information about the Python-list mailing list