Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
I learn python from time to time when I want to write simple script for myself so my answer could be wrong.
I found it in python (standalone not poser's python folder):
c:Python24Liblib-tkTkinter.py
open that file and go to the very end of it. You'll see an example with :
# The following three commands are needed so the window pops
# up on top on Windows...
root.iconify()
root.update()
root.deiconify()
I personaly use it and it gives me the focus on main window after the script was executed.
The real problem here is that the tkinter main loop isn't integrated with Poser's own.
If you look at other scripts with tkinter GUIs (a lot of ockham's have them) you'll see the technique required to keep a tkinter window above the Poser window.
When using Poser's own dialogs, this problem doesn't arise, but the variety of controls is limited, and you can only have modal dialogs.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
So I have created a Tk widget in which you're required to select an output directory. If you press the action button (which performs renders) and you have not yet selected an output directory, it will pop up a warning dialog saying "You must choose an output directory!"
The problem is, after pressing "OK" to banish the warning dialog, my GUI disappears behind Poser's document window. I have to click it in the Windows taskbar or Alt+Tab to it to make it reappear.
Is there a way to make the application's focus automatically return to the main Tk widget after it's spawned a warning dialog?
ETA: I've also noticed Poser is kind of flaky about displaying Python guis. Even when I do click on the widget in the taskbar, it seems to slow Poser down, take a long time to redraw after being moved, and sometimes I have to click it several times to make it reappear because it keeps disappearing behind the document window again. Is this typical?