deiconify is just plain f*ucked in windows

gcash gcash at luncheonmeat.cfl.rr.com
Tue Sep 4 22:38:22 EDT 2001


Ok, I'm at the end of my rope here.  I wanted to notify folks of things
that happen.  These things that happen are rare but when they happen,
people need to know.  This needed to work on multiple platforms including
Windows.  So I installed a Jabber server.  This was the perfect solution
except none of the Windows clients have a decent popup action.  I need it
to get in your face with a window on the top of the stack, like AIM when
you get a message.  "hey buddy, the server's on fire"  "yo bucko, there are
16 FBI agents at the door with your name in lights"

OK, so I figured I've been writing Python & Tkinter GUIs for a while, and
the Windows install is a breeze even for folks with a room temperature IQ.
So I sat down and grabbed a Python module that handled the Jabber XML
protocol, and in a couple days had a working program in X11.  I was careful
to make it non-threaded and rolled my own mainloop so there would be no
nasty thread-safeness issues.  I didn't use createfilehandler() to handle
my sockets because I know that's not implemented on Windows.  I did all the
right things.  The main window is just a Text widget and a button, I didn't
try for super functionality.

Except that root.deiconify() just doesn't work under Windows.  

It'll pop up the first couple of times.  If the window had the focus before
being iconified, it *might* popup on top.  Otherwise it pops up on the dead
bottom of the window stack, and lift() doesn't do a goddamn thing.  It just
sits there blinking the taskbar icon until you flip through and give it the
focus.

Even though it seems focus related,  focus_force(), focus_set(),
grab_set_global() don't help.

I tried changing root.deiconify() to root.tk.eval('wm deiconify .') and it
doesn't make a bit of difference.  Same behaviour.

I thought maybe the original window is "special" in some broken way and
created my own Toplevel window.  That didn't work.

I tried doing a withdraw() before the deiconify().  No luck.

I looked at Pmw and tried it's setgeometryanddeiconify() and that didn't work.

I went out on Google and tried the:
        root.iconify()
        root.update()
        root.deiconify()
trick that Guido suggests, and that works about 70% of the time.

I tried a whole bunch of other things that I can't remember right now.

Now what I want to know is why the hell this is borked in Tkinter when
deiconify() works just fine as many times as you want in wish or a tcl
script??????  Why do these things work a couple of times then stop????  

In a tcl script I can "wm deiconify ." all day long and it always pops to
the front, so it's not a tk bug.  It's a tkinter problem.

I'm using Python 2.1.1 and the Tk/TCL 8.3.3 that comes with it.

I'd write it in tcl if I had an XML library for it.  I've tried writing it
in win32 using win32gui_dialog.py as a start except I don't know crap about
win32 and my attempts at replacing the List control with a RichText control
have failed.  None of the local bookstores have anything decent about win32
that isn't "open visual basic, click on this, click on that, select this
menu item, etc. etc."

I know from Google that nobody else has any answers, but frustration forces
me to say something.

-gc

-- 
Favorite god: Thor               Favorite song: "Hammer Time"
Motto: "Use a bigger hammer"     In my toolbox: 1 screwdriver, 6 hammers.
Often heard saying: "... then I used a hammer on it"



More information about the Python-list mailing list