Hey all,

I'm trying to get system modal functionality like the UAC dialog.

According to http://developex.com/blog/system-modal-back/ the thing to do is to create and switch to a new desktop.

Therefore, I'm doing:

hDeskOld=win32service.GetThreadDesktop(win32api.GetCurrentThreadId())
hDesk=win32service.CreateDesktop("SysModalDesktop",0,win32con.GENERIC_ALL,None)
    hDesk.SwitchDesktop() # switch to the new desktop
    try:
        root=Tk()
        app=SysmodalDialog(root,title,message,img)
        app.mainloop()
    except Exception,e:
        print e
    hDeskOld.SwitchDesktop() # switch back
    hDesk.CloseDesktop() # done

The tk stuff inside the try works fine on its own.
If I replace the Tk stuff with time.sleep(5.0), then desktops switch fine as well.

The problem is I can't get the tk app to show on the new desktop (and therefore mainloop() blocks and I can't get back out of it!)

I tried changing Tk() to Tk(screenName="SysModalDesktop") but that didn't make a difference.

How do I make my window go to the right desktop??

-Kurt



_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to