Wed, Jan 8, 1:01 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Making Dialog box stay on top (automatically return focus?)


Amadan ( ) posted Thu, 16 April 2009 at 12:43 PM · edited Thu, 08 August 2024 at 12:48 PM

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?


Adom ( ) posted Sat, 18 April 2009 at 5:51 AM

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.


nruddock ( ) posted Sat, 18 April 2009 at 6:43 AM

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.


Privacy Notice

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.